From fb95633909142cd34a9a4bc82e89c7186bb0b934 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Tue, 30 Aug 2022 12:15:56 +0300 Subject: [PATCH 1/2] Don't use require in ESM, use dynamic import --- src/MonacoEditor.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/MonacoEditor.js b/src/MonacoEditor.js index 5308716..379278d 100644 --- a/src/MonacoEditor.js +++ b/src/MonacoEditor.js @@ -80,13 +80,12 @@ export default { }) }) } else { - // ESM format so it can't be resolved by commonjs `require` in eslint - // eslint-disable-next-line import/no-unresolved - const monaco = require('monaco-editor') - this.monaco = monaco - this.$nextTick(() => { - this.initMonaco(monaco) - }) + import('monaco-editor').then((monaco) => { + this.monaco = monaco; + this.$nextTick(function () { + _this.initMonaco(monaco); + }); + }); } }, From 116043a545c2618a88646ca48dc2d75ae5811522 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Tue, 30 Aug 2022 12:34:48 +0300 Subject: [PATCH 2/2] Fix this reference --- src/MonacoEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MonacoEditor.js b/src/MonacoEditor.js index 379278d..ccaaa96 100644 --- a/src/MonacoEditor.js +++ b/src/MonacoEditor.js @@ -82,8 +82,8 @@ export default { } else { import('monaco-editor').then((monaco) => { this.monaco = monaco; - this.$nextTick(function () { - _this.initMonaco(monaco); + this.$nextTick(() => { + this.initMonaco(monaco); }); }); }