Skip to content

Commit df2f0ed

Browse files
committed
defer file generation
1 parent eed998c commit df2f0ed

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/react-dev-utils/ExtractHtmlManifestPlugin.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ class ExtractHtmlManifestPlugin {
2828
},
2929
opts || {}
3030
);
31+
this.output = '{}';
3132
}
3233

3334
apply(compiler) {
3435
compiler.hooks.compilation.tap('ExtractHtmlManifestPlugin', compilation => {
3536
this.htmlWebpackPlugin
3637
.getHooks(compilation)
3738
.beforeAssetTagGeneration.tap('ExtractHtmlManifestPlugin', data => {
38-
var outputFolder = compiler.options.output.path;
39-
var outputFile = path.resolve(outputFolder, this.opts.fileName);
40-
var output = this.opts.serialize(data.assets);
41-
fs.writeFileSync(outputFile, output, 'utf8');
39+
this.output = this.opts.serialize(data.assets);
4240
});
4341
});
42+
compiler.hooks.afterEmit.tap('ExtractHtmlManifestPlugin', () => {
43+
var outputFolder = compiler.options.output.path;
44+
var outputFile = path.resolve(outputFolder, this.opts.fileName);
45+
fs.writeFileSync(outputFile, this.output, 'utf8');
46+
});
4447
}
4548
}
4649

0 commit comments

Comments
 (0)