fix(monaco-editor-webpack-plugin): load monaco-editor with webpack 4

Closes #2817
pull/2818/head
ValeraS 3 years ago
parent 3e433551a9
commit 3ae92d5f1a

@ -1,6 +1,6 @@
{
"name": "monaco-editor-webpack-plugin",
"version": "6.0.0",
"version": "7.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -266,8 +266,7 @@
"big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
"dev": true
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
},
"brace-expansion": {
"version": "1.1.11",
@ -381,8 +380,7 @@
"emojis-list": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
"dev": true
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
},
"enhanced-resolve": {
"version": "5.8.3",
@ -685,7 +683,6 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
@ -703,9 +700,14 @@
"dev": true
},
"loader-utils": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz",
"integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"locate-path": {
"version": "5.0.0",
@ -764,8 +766,7 @@
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"monaco-editor": {
"version": "0.31.0",

@ -43,6 +43,6 @@
"webpack-cli": "^4.9.1"
},
"dependencies": {
"loader-utils": "^3.2.0"
"loader-utils": "^2.0.2"
}
}

@ -1,3 +1,5 @@
declare module 'loader-utils' {
export function interpolateName(loaderContext: any, name: string, options?: any): string;
export function stringifyRequest(loaderContext: any, resource: string): string;
}

@ -1,4 +1,5 @@
import type { PitchLoaderDefinitionFunction } from 'webpack';
import * as loaderUtils from 'loader-utils';
export interface ILoaderOptions {
globals?: { [key: string]: string };
@ -9,7 +10,7 @@ export interface ILoaderOptions {
export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pitch(
remainingRequest
) {
const { globals = undefined, pre = [], post = [] } = this.getOptions() || {};
const { globals = undefined, pre = [], post = [] } = (this.query as ILoaderOptions) || {};
// HACK: NamedModulesPlugin overwrites existing modules when requesting the same module via
// different loaders, so we need to circumvent this by appending a suffix to make the name unique
@ -19,7 +20,10 @@ export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pit
}
const stringifyRequest = (request: string) => {
return JSON.stringify(this.utils.contextify(this.context || this.rootContext, request));
if (this.utils) {
return JSON.stringify(this.utils.contextify(this.context || this.rootContext, request));
}
return loaderUtils.stringifyRequest(this, request);
};
return [

Loading…
Cancel
Save