diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 4d6c0857..ba5e0edf 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -10,8 +10,6 @@ import Emitter = monaco.Emitter; import IEvent = monaco.IEvent; import IDisposable = monaco.IDisposable; -declare var require: (moduleId: [string], callback: (module: T) => void) => void; - // --- JSON configuration and defaults --------- export class LanguageServiceDefaultsImpl implements monaco.languages.json.LanguageServiceDefaults { @@ -62,8 +60,8 @@ monaco.languages.json = createAPI(); // --- Registration to monaco editor --- -function withMode(callback: (module: typeof mode) => void): void { - require(['./jsonMode'], callback); +function getMode(): monaco.Promise { + return monaco.Promise.wrap(import('./jsonMode')) } monaco.languages.register({ @@ -73,5 +71,5 @@ monaco.languages.register({ mimetypes: ['application/json'], }); monaco.languages.onLanguage('json', () => { - withMode(mode => mode.setupMode(jsonDefaults)); + getMode().then(mode => mode.setupMode(jsonDefaults)); }); diff --git a/src/tsconfig.json b/src/tsconfig.json index a00c7267..56db01bb 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,8 +1,14 @@ { "compilerOptions": { - "module": "es6", + "module": "esnext", "moduleResolution": "node", "outDir": "../out", - "target": "es5" + "target": "es5", + "lib": [ + "dom", + "es5", + "es2015.collection", + "es2015.promise" + ] } } \ No newline at end of file