Skip to content

Commit 5ee12ee

Browse files
committed
Resolve "Chunk does not have associated output files" when chunk outputs include nonexecutable .map files
1 parent 8240e19 commit 5ee12ee

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ssr",
3-
"version": "0.10.17",
3+
"version": "0.10.18",
44
"description": "Angular server-side rendering implementation",
55
"main": "build/index.js",
66
"typings": "build/index.d.ts",

source/application/compiler/webpack/loader.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ export class WebpackModuleLoader implements ModuleLoader {
2121
throw new CompilerException(`Cannot find a webpack chunk with the name ${module.source}`);
2222
}
2323

24-
if (matchingChunk.files == null ||
25-
matchingChunk.files.length !== 1) {
26-
throw new CompilerException(`Chunk ${module.source} does not have associated output files`);
24+
const js = (matchingChunk.files || []).filter(f => /\.js$/.test(f));
25+
switch (js.length) {
26+
case 0: throw new CompilerException(`Chunk ${module.source} does not have associated output files`);
27+
case 1: break;
28+
default: throw new CompilerException(`Chunk ${module.source} has more than one JavaScript output: ${js.join(', ')}`);
2729
}
2830

29-
const candidate = join(this.project.workingPath.toString(), matchingChunk.files[0]);
31+
const candidate = join(this.project.workingPath.toString(), js[0]);
3032

3133
const loaded = require(candidate);
3234

0 commit comments

Comments
 (0)