diff options
author | Alexandru Dima <alexdima@microsoft.com> | 2022-06-15 15:51:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 15:51:27 +0300 |
commit | 5e7d488b7c3f9dc4a040d2ab31dfce0f843dd30a (patch) | |
tree | 2fca28128590155151d21bf5ef62b0029081cd35 | |
parent | 68433fb7fdd6f16c1f86ef2e88e90dd070785b43 (diff) |
Improve error message when a module cannot be bundled and exclude vs/nls from bundles (#152188)
-rw-r--r-- | build/gulpfile.editor.js | 1 | ||||
-rw-r--r-- | build/lib/bundle.js | 11 | ||||
-rw-r--r-- | build/lib/bundle.ts | 12 | ||||
-rw-r--r-- | src/buildfile.js | 2 |
4 files changed, 23 insertions, 3 deletions
diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 3d8a85fd7f9..3b3fe4942d8 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -34,6 +34,7 @@ const editorEntryPoints = [ { name: 'vs/base/common/worker/simpleWorker', include: ['vs/editor/common/services/editorSimpleWorker'], + exclude: ['vs/nls'], prepend: ['vs/loader.js'], append: ['vs/base/worker/workerMain'], dest: 'vs/base/worker/workerMain.js' diff --git a/build/lib/bundle.js b/build/lib/bundle.js index 8c1967d4c68..4cf08aef429 100644 --- a/build/lib/bundle.js +++ b/build/lib/bundle.js @@ -298,9 +298,18 @@ function emitEntryPoint(modulesMap, deps, entryPoint, includedModules, prepend, if (module.shim) { mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents)); } - else { + else if (module.defineLocation) { mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents)); } + else { + const moduleCopy = { + id: module.id, + path: module.path, + defineLocation: module.defineLocation, + dependencies: module.dependencies + }; + throw new Error(`Cannot bundle module '${module.id}' for entry point '${entryPoint}' because it has no shim and it lacks a defineLocation: ${JSON.stringify(moduleCopy)}`); + } }); Object.keys(usedPlugins).forEach((pluginName) => { const plugin = usedPlugins[pluginName]; diff --git a/build/lib/bundle.ts b/build/lib/bundle.ts index a1130d4bbbd..4c8a3e14589 100644 --- a/build/lib/bundle.ts +++ b/build/lib/bundle.ts @@ -15,7 +15,7 @@ interface IPosition { interface IBuildModuleInfo { id: string; path: string; - defineLocation: IPosition; + defineLocation: IPosition | null; dependencies: string[]; shim: string; exports: any; @@ -444,8 +444,16 @@ function emitEntryPoint( if (module.shim) { mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents)); - } else { + } else if (module.defineLocation) { mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents)); + } else { + const moduleCopy = { + id: module.id, + path: module.path, + defineLocation: module.defineLocation, + dependencies: module.dependencies + }; + throw new Error(`Cannot bundle module '${module.id}' for entry point '${entryPoint}' because it has no shim and it lacks a defineLocation: ${JSON.stringify(moduleCopy)}`); } }); diff --git a/src/buildfile.js b/src/buildfile.js index 6b49aa30083..f0f49f65459 100644 --- a/src/buildfile.js +++ b/src/buildfile.js @@ -32,12 +32,14 @@ exports.base = [ { name: 'vs/editor/common/services/editorSimpleWorker', include: ['vs/base/common/worker/simpleWorker'], + exclude: ['vs/nls'], prepend: ['vs/loader.js', 'vs/nls.js'], append: ['vs/base/worker/workerMain'], dest: 'vs/base/worker/workerMain.js' }, { name: 'vs/base/common/worker/simpleWorker', + exclude: ['vs/nls'], } ]; |