Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-02-02 02:23:03 +0300
committerMike Greiling <mike@pixelcog.com>2018-02-02 05:50:16 +0300
commit8ebe2f7ae6872ff8553fb0f3482df209270c874b (patch)
tree252552d7e3596b2da40bb3ce645ce6d542ad761d /config
parentdd75c337e5ee036fca8188d5b7adbf6e7725570f (diff)
prevent dynamic chunks from being duplicated by the dispatcher until it is completely refactored
Diffstat (limited to 'config')
-rw-r--r--config/webpack.config.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js
index ed064be690c..7f3fe551a03 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -25,11 +25,22 @@ var NO_COMPRESSION = process.env.NO_COMPRESSION;
var autoEntries = {};
var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') });
+// filter out entries currently imported dynamically in dispatcher.js
+var dispatcher = fs.readFileSync(path.join(ROOT_PATH, 'app/assets/javascripts/dispatcher.js')).toString();
+var dispatcherChunks = dispatcher.match(/(?!import\('.\/)pages\/[^']+/g);
+
pageEntries.forEach(( path ) => {
- let chunkName = path.replace(/\/index\.js$/, '').replace(/\//g, '.');
- autoEntries[chunkName] = './' + path;
+ let chunkPath = path.replace(/\/index\.js$/, '');
+ if (!dispatcherChunks.includes(chunkPath)) {
+ let chunkName = chunkPath.replace(/\//g, '.');
+ autoEntries[chunkName] = './' + path;
+ }
});
+// report our auto-generated bundle count
+var autoEntriesCount = Object.keys(autoEntries).length;
+console.log(`${autoEntriesCount} entries from '/pages' automatically added to webpack output.`);
+
var config = {
// because sqljs requires fs.
node: {