Don't load monaco.contribution.ts twice.

Fixes #2866, #2931.
pull/2935/head
Henning Dieterichs 3 years ago
parent 91edee5791
commit 69809452a8
No known key found for this signature in database
GPG Key ID: 771381EFFDB9EC06

@ -47,7 +47,7 @@ buildESM({
'src/language/css/cssMode.ts',
'src/language/css/css.worker.ts'
],
external: ['monaco-editor-core', '*/cssMode']
external: ['monaco-editor-core', '*/cssMode', '*/monaco.contribution']
});
buildAMD({
base: 'language/css',
@ -58,7 +58,8 @@ buildAMD({
buildAMD({
base: 'language/css',
entryPoint: 'src/language/css/cssMode.ts',
amdModuleId: 'vs/language/css/cssMode'
amdModuleId: 'vs/language/css/cssMode',
external: ['*/monaco.contribution']
});
buildAMD({
base: 'language/css',
@ -77,7 +78,7 @@ buildESM({
'src/language/html/htmlMode.ts',
'src/language/html/html.worker.ts'
],
external: ['monaco-editor-core', '*/htmlMode']
external: ['monaco-editor-core', '*/htmlMode', '*/monaco.contribution']
});
buildAMD({
base: 'language/html',
@ -88,7 +89,8 @@ buildAMD({
buildAMD({
base: 'language/html',
entryPoint: 'src/language/html/htmlMode.ts',
amdModuleId: 'vs/language/html/htmlMode'
amdModuleId: 'vs/language/html/htmlMode',
external: ['*/monaco.contribution']
});
buildAMD({
base: 'language/html',
@ -107,7 +109,7 @@ buildESM({
'src/language/json/jsonMode.ts',
'src/language/json/json.worker.ts'
],
external: ['monaco-editor-core', '*/jsonMode']
external: ['monaco-editor-core', '*/jsonMode', '*/monaco.contribution']
});
buildAMD({
base: 'language/json',
@ -118,7 +120,8 @@ buildAMD({
buildAMD({
base: 'language/json',
entryPoint: 'src/language/json/jsonMode.ts',
amdModuleId: 'vs/language/json/jsonMode'
amdModuleId: 'vs/language/json/jsonMode',
external: ['*/monaco.contribution']
});
buildAMD({
base: 'language/json',
@ -142,7 +145,7 @@ buildESM({
'src/language/typescript/tsMode.ts',
'src/language/typescript/ts.worker.ts'
],
external: ['monaco-editor-core', '*/tsMode']
external: ['monaco-editor-core', '*/tsMode', '*/monaco.contribution']
});
buildAMD({
base: 'language/typescript',
@ -153,7 +156,8 @@ buildAMD({
buildAMD({
base: 'language/typescript',
entryPoint: 'src/language/typescript/tsMode.ts',
amdModuleId: 'vs/language/typescript/tsMode'
amdModuleId: 'vs/language/typescript/tsMode',
external: ['*/monaco.contribution']
});
buildAMD({
base: 'language/typescript',

@ -155,9 +155,15 @@ exports.buildESM = buildESM;
* entryPoint: string;
* amdModuleId: string;
* amdDependencies?: string[];
* external?: string[];
* }} options
*/
function buildOneAMD(type, options) {
if (!options.amdDependencies) {
options.amdDependencies = [];
}
options.amdDependencies.unshift('require');
/** @type {import('esbuild').BuildOptions} */
const opts = {
entryPoints: [options.entryPoint],
@ -169,9 +175,9 @@ function buildOneAMD(type, options) {
},
globalName: 'moduleExports',
banner: {
js: `${bundledFileHeader}define("${options.amdModuleId}",[${(options.amdDependencies || [])
js: `${bundledFileHeader}define("${options.amdModuleId}", [${(options.amdDependencies || [])
.map((dep) => `"${dep}"`)
.join(',')}],()=>{`
.join(',')}],(require)=>{`
},
footer: {
js: 'return moduleExports;\n});'
@ -184,7 +190,7 @@ function buildOneAMD(type, options) {
'monaco-editor-core': path.join(__dirname, '../src/fillers/monaco-editor-core-amd.ts')
})
],
external: ['vs/editor/editor.api']
external: ['vs/editor/editor.api', ...(options.external || [])]
};
if (type === 'min') {
opts.minify = true;
@ -198,6 +204,7 @@ function buildOneAMD(type, options) {
* entryPoint: string;
* amdModuleId: string;
* amdDependencies?: string[];
* external?: string[];
* }} options
*/
function buildAMD(options) {

Loading…
Cancel
Save