Skip to content

Commit f4c80e6

Browse files
committed
Allow resetting the state of the Encore singleton
1 parent c5c3d23 commit f4c80e6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (!runtimeConfig) {
2020
throw new Error('Are you trying to require index.js directly?');
2121
}
2222

23-
const webpackConfig = new WebpackConfig(runtimeConfig);
23+
let webpackConfig = new WebpackConfig(runtimeConfig);
2424

2525
module.exports = {
2626
/**
@@ -396,7 +396,7 @@ module.exports = {
396396
/**
397397
* Is this currently a "production" build?
398398
*
399-
* @returns {*}
399+
* @returns {boolean}
400400
*/
401401
isProduction() {
402402
return webpackConfig.isProduction();
@@ -421,5 +421,17 @@ module.exports = {
421421
console.log(pe.render(error));
422422
process.exit(1); // eslint-disable-line
423423
}
424+
},
425+
426+
/**
427+
* Resets the Encore state to allow building a new config.
428+
*
429+
* getWebpackConfig should be used before resetting to build
430+
* a config for the existing state.
431+
*
432+
* @returns {void}
433+
*/
434+
reset() {
435+
webpackConfig = new WebpackConfig(runtimeConfig);
424436
}
425437
};

0 commit comments

Comments
 (0)