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

This commit is contained in:
Alexandru Dima
2022-06-15 14:51:27 +02:00
committed by GitHub
parent 68433fb7fd
commit 5e7d488b7c
4 changed files with 23 additions and 3 deletions

View File

@@ -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];