Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when a module cannot be bundled and exclude vs/nls from bundles #152188

Merged
merged 1 commit into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions build/gulpfile.editor.js
Expand Up @@ -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'
Expand Down
11 changes: 10 additions & 1 deletion build/lib/bundle.js
Expand Up @@ -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];
Expand Down
12 changes: 10 additions & 2 deletions build/lib/bundle.ts
Expand Up @@ -15,7 +15,7 @@ interface IPosition {
interface IBuildModuleInfo {
id: string;
path: string;
defineLocation: IPosition;
defineLocation: IPosition | null;
dependencies: string[];
shim: string;
exports: any;
Expand Down Expand Up @@ -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)}`);
}
});

Expand Down
2 changes: 2 additions & 0 deletions src/buildfile.js
Expand Up @@ -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'],
}
];

Expand Down