diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-02-01 17:23:03 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-02-01 20:50:16 -0600 |
commit | 8ebe2f7ae6872ff8553fb0f3482df209270c874b (patch) | |
tree | 252552d7e3596b2da40bb3ce645ce6d542ad761d /config/webpack.config.js | |
parent | dd75c337e5ee036fca8188d5b7adbf6e7725570f (diff) | |
download | gitlab-ce-8ebe2f7ae6872ff8553fb0f3482df209270c874b.tar.gz |
prevent dynamic chunks from being duplicated by the dispatcher until it is completely refactored
Diffstat (limited to 'config/webpack.config.js')
-rw-r--r-- | config/webpack.config.js | 15 |
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: { |