Skip to content

Commit b41d013

Browse files
fix: handle hashed bundles
1 parent d63061a commit b41d013

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/commands/serve.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ export function serve(
9191
modulesFolder,
9292
homeDir,
9393
cache,
94-
output: `${browserOutput}/$name-$hash.js`,
94+
hash: isProdBuild,
95+
output: `${browserOutput}/$name.js`,
9596
target: 'browser@es5',
9697
useTypescriptCompiler: true,
97-
hash: isProdBuild,
9898
plugins: [
9999
isAotBuild && NgAotFactoryPlugin(),
100100
isAotBuild &&
@@ -107,7 +107,7 @@ export function serve(
107107
Ng2TemplatePlugin(),
108108
['*.component.html', RawPlugin()],
109109
WebIndexPlugin({
110-
bundles: ['app', 'vendor'],
110+
bundles: ['vendor', 'app'],
111111
path: 'js',
112112
target: '../index.html',
113113
template: resolve('src/app/index.pug'),

src/fusebox/compression.plugin.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,21 @@ export class CompressionPluginClass implements Plugin {
4040
Array.from(producer.bundles)
4141
.map(bundle => bundle[1].context.output)
4242
.map(bundleOutput => {
43-
return readFile_(
44-
`${bundleOutput.dir}/${bundleOutput.filename}.js`
45-
).pipe(
43+
return readFile_(bundleOutput.lastWrittenPath).pipe(
4644
flatMap(file => {
4745
return forkJoin([
4846
gzip_(file, { level: 9 }).pipe(
4947
flatMap(compressed =>
5048
bundleOutput.writeToOutputFolder(
51-
`${bundleOutput.filename}.js.gzip`,
49+
`${bundleOutput.lastGeneratedFileName}.gzip`,
5250
compressed
5351
)
5452
)
5553
),
5654
brotli_(file).pipe(
5755
flatMap(compressed =>
5856
bundleOutput.writeToOutputFolder(
59-
`${bundleOutput.filename}.js.br`,
57+
`${bundleOutput.lastGeneratedFileName}.br`,
6058
compressed
6159
)
6260
)

0 commit comments

Comments
 (0)