mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-21 14:19:42 +02:00
Code splitting now works through awaited import (#6)
This commit is contained in:
parent
e7e64cea3e
commit
5c0560a2ed
11 changed files with 214 additions and 500 deletions
|
@ -1,8 +1,10 @@
|
|||
/**
|
||||
* Module for pages create/edit
|
||||
*/
|
||||
module.exports = class Writing {
|
||||
export default class Writing {
|
||||
constructor(){
|
||||
this.editorWrapper = null;
|
||||
this.editor = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,15 +16,14 @@ module.exports = class Writing {
|
|||
|
||||
moduleEl.appendChild(this.editorWrapper);
|
||||
|
||||
|
||||
this.loadEditor().then(() => {
|
||||
console.log('Editor loaded');
|
||||
this.loadEditor().then((editor) => {
|
||||
this.editor = editor;
|
||||
})
|
||||
};
|
||||
|
||||
loadEditor(){
|
||||
return import(/* webpackChunkName: "codex-editor" */ 'codex.editor').then(({ default: CodexEditor }) => {
|
||||
console.log('codex-editor', new CodexEditor());
|
||||
}).catch(error => 'An error occurred while loading CodeX Editor');
|
||||
async loadEditor(){
|
||||
const {default: Editor} = await import(/* webpackChunkName: "editor" */ './../classes/editor');
|
||||
|
||||
return new Editor();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue