mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
tune(monaco-editor-webpack-plugin): replace editor.main.js
Replace editor.main.js with editor.api.js and requested features and languages
This commit is contained in:
parent
04ece42881
commit
213f1821ec
2 changed files with 5 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
import * as monaco from 'monaco-editor';
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
// create div to avoid needing a HtmlWebpackPlugin template
|
// create div to avoid needing a HtmlWebpackPlugin template
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,16 @@ export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pit
|
||||||
return loaderUtils.stringifyRequest(this, request);
|
return loaderUtils.stringifyRequest(this, request);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// editor.main.js contains all features and languages, replace it with requested features, languages and editor.api.js
|
||||||
|
const apiRequest = remainingRequest.replace(/editor\.main\.js$/, 'editor.api.js');
|
||||||
return [
|
return [
|
||||||
...(globals
|
...(globals
|
||||||
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
||||||
: []),
|
: []),
|
||||||
...pre.map((include: any) => `import ${stringifyRequest(include)};`),
|
...pre.map((include: any) => `import ${stringifyRequest(include)};`),
|
||||||
`
|
`
|
||||||
import * as monaco from ${stringifyRequest(`!!${remainingRequest}`)};
|
import * as monaco from ${stringifyRequest(`!!${apiRequest}`)};
|
||||||
export * from ${stringifyRequest(`!!${remainingRequest}`)};
|
export * from ${stringifyRequest(`!!${apiRequest}`)};
|
||||||
export default monaco;
|
export default monaco;
|
||||||
`,
|
`,
|
||||||
...post.map((include: any) => `import ${stringifyRequest(include)};`)
|
...post.map((include: any) => `import ${stringifyRequest(include)};`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue