Fix problem with duplicated entry points

This commit is contained in:
Alex Dima
2021-11-09 23:41:02 +01:00
parent 6670578157
commit c30ffc4a7e
3 changed files with 8 additions and 2 deletions

View File

@@ -100,6 +100,9 @@ export interface ILoaderConfig {
export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callback: (err: any, result: IBundleResult | null) => void): void {
const entryPointsMap: IEntryPointMap = {};
entryPoints.forEach((module: IEntryPoint) => {
if (entryPointsMap[module.name]) {
throw new Error(`Cannot have two entry points with the same name '${module.name}'`);
}
entryPointsMap[module.name] = module;
});