Skip to content

Commit efbec0d

Browse files
committed
feature #83 Allow resetting the state of the Encore singleton (stof)
This PR was merged into the master branch. Discussion ---------- Allow resetting the state of the Encore singleton Closes #48 Commits ------- f4c80e6 Allow resetting the state of the Encore singleton
2 parents ba036c4 + f4c80e6 commit efbec0d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

index.js

+14-2
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
/**
@@ -411,7 +411,7 @@ module.exports = {
411411
/**
412412
* Is this currently a "production" build?
413413
*
414-
* @returns {*}
414+
* @returns {boolean}
415415
*/
416416
isProduction() {
417417
return webpackConfig.isProduction();
@@ -436,5 +436,17 @@ module.exports = {
436436
console.log(pe.render(error));
437437
process.exit(1); // eslint-disable-line
438438
}
439+
},
440+
441+
/**
442+
* Resets the Encore state to allow building a new config.
443+
*
444+
* getWebpackConfig should be used before resetting to build
445+
* a config for the existing state.
446+
*
447+
* @returns {void}
448+
*/
449+
reset() {
450+
webpackConfig = new WebpackConfig(runtimeConfig);
439451
}
440452
};

0 commit comments

Comments
 (0)