mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
fix(monaco-editor-webpack-plugin): load monaco-editor with webpack 4
Closes #2817
This commit is contained in:
parent
3e433551a9
commit
3ae92d5f1a
4 changed files with 21 additions and 14 deletions
23
webpack-plugin/package-lock.json
generated
23
webpack-plugin/package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor-webpack-plugin",
|
"name": "monaco-editor-webpack-plugin",
|
||||||
"version": "6.0.0",
|
"version": "7.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
@ -266,8 +266,7 @@
|
||||||
"big.js": {
|
"big.js": {
|
||||||
"version": "5.2.2",
|
"version": "5.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||||
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
|
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
|
|
@ -381,8 +380,7 @@
|
||||||
"emojis-list": {
|
"emojis-list": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
|
||||||
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
|
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"enhanced-resolve": {
|
"enhanced-resolve": {
|
||||||
"version": "5.8.3",
|
"version": "5.8.3",
|
||||||
|
|
@ -685,7 +683,6 @@
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
||||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "^1.2.5"
|
"minimist": "^1.2.5"
|
||||||
}
|
}
|
||||||
|
|
@ -703,9 +700,14 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"loader-utils": {
|
"loader-utils": {
|
||||||
"version": "3.2.0",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
|
||||||
"integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ=="
|
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
|
||||||
|
"requires": {
|
||||||
|
"big.js": "^5.2.2",
|
||||||
|
"emojis-list": "^3.0.0",
|
||||||
|
"json5": "^2.1.2"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"locate-path": {
|
"locate-path": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
|
|
@ -764,8 +766,7 @@
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"monaco-editor": {
|
"monaco-editor": {
|
||||||
"version": "0.31.0",
|
"version": "0.31.0",
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,6 @@
|
||||||
"webpack-cli": "^4.9.1"
|
"webpack-cli": "^4.9.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loader-utils": "^3.2.0"
|
"loader-utils": "^2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
webpack-plugin/src/loader-utils.d.ts
vendored
2
webpack-plugin/src/loader-utils.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
declare module 'loader-utils' {
|
declare module 'loader-utils' {
|
||||||
export function interpolateName(loaderContext: any, name: string, options?: any): string;
|
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 type { PitchLoaderDefinitionFunction } from 'webpack';
|
||||||
|
import * as loaderUtils from 'loader-utils';
|
||||||
|
|
||||||
export interface ILoaderOptions {
|
export interface ILoaderOptions {
|
||||||
globals?: { [key: string]: string };
|
globals?: { [key: string]: string };
|
||||||
|
|
@ -9,7 +10,7 @@ export interface ILoaderOptions {
|
||||||
export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pitch(
|
export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pitch(
|
||||||
remainingRequest
|
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
|
// 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
|
// 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) => {
|
const stringifyRequest = (request: string) => {
|
||||||
|
if (this.utils) {
|
||||||
return JSON.stringify(this.utils.contextify(this.context || this.rootContext, request));
|
return JSON.stringify(this.utils.contextify(this.context || this.rootContext, request));
|
||||||
|
}
|
||||||
|
return loaderUtils.stringifyRequest(this, request);
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue