Skip to content

Commit a4a6665

Browse files
committed
Working around missing manifest.json bug
1 parent d549499 commit a4a6665

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,11 +1421,11 @@ class Encore {
14211421
* // common values: asset, asset/resource, asset/inline
14221422
* // Using "asset" will allow smaller images to be "inlined"
14231423
* // instead of copied.
1424-
* // javascript/auto caan be used to disable asset images (see next example)
1424+
* // javascript/auto can be used to disable asset images (see next example)
14251425
* type: 'asset/resource',
14261426
*
14271427
* // applicable when for "type: asset": files smaller than this
1428-
* // size will be "inlined" into CSS, larer files will be extracted
1428+
* // size will be "inlined" into CSS, larger files will be extracted
14291429
* // into independent files
14301430
* maxSize: 4 * 1024, // 4 kb
14311431
*

lib/plugins/clean.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ module.exports = function(plugins, webpackConfig) {
2727
return;
2828
}
2929

30+
const cleanOnceBeforeBuildPatterns = webpackConfig.cleanWebpackPluginPaths;
31+
// works around a bug where manifest.json is emitted when
32+
// using dev-server... but then CleanWebpackPlugin deletes it
33+
cleanOnceBeforeBuildPatterns.push('!manifest.json');
34+
3035
const cleanWebpackPluginOptions = {
3136
verbose: false,
3237
cleanOnceBeforeBuildPatterns: webpackConfig.cleanWebpackPluginPaths,

test/plugins/clean.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('plugins/clean', () => {
4141
cleanPluginUtil(plugins, config);
4242
expect(plugins.length).to.equal(1);
4343
expect(plugins[0].plugin).to.be.instanceof(CleanWebpackPlugin);
44-
expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*']);
44+
expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*', '!manifest.json']);
4545
expect(plugins[0].plugin.dry).to.equal(false);
4646
});
4747

@@ -56,7 +56,7 @@ describe('plugins/clean', () => {
5656
cleanPluginUtil(plugins, config);
5757
expect(plugins.length).to.equal(1);
5858
expect(plugins[0].plugin).to.be.instanceof(CleanWebpackPlugin);
59-
expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*.js', '**/*.css']);
59+
expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*.js', '**/*.css', '!manifest.json']);
6060
expect(plugins[0].plugin.dry).to.equal(true);
6161
});
6262

0 commit comments

Comments
 (0)