Commit 8ebe2f7a authored by Mike Greiling's avatar Mike Greiling

prevent dynamic chunks from being duplicated by the dispatcher until it is completely refactored

parent dd75c337
...@@ -56,7 +56,7 @@ import SearchAutocomplete from './search_autocomplete'; ...@@ -56,7 +56,7 @@ import SearchAutocomplete from './search_autocomplete';
break; break;
case 'projects:boards:show': case 'projects:boards:show':
case 'projects:boards:index': case 'projects:boards:index':
import('./pages/projects/boards/index') import('./pages/projects/boards')
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
shortcut_handler = true; shortcut_handler = true;
...@@ -363,7 +363,7 @@ import SearchAutocomplete from './search_autocomplete'; ...@@ -363,7 +363,7 @@ import SearchAutocomplete from './search_autocomplete';
.catch(fail); .catch(fail);
break; break;
case 'projects:project_members:index': case 'projects:project_members:index':
import('./pages/projects/project_members/') import('./pages/projects/project_members')
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
...@@ -605,7 +605,7 @@ import SearchAutocomplete from './search_autocomplete'; ...@@ -605,7 +605,7 @@ import SearchAutocomplete from './search_autocomplete';
} }
break; break;
case 'profiles': case 'profiles':
import('./pages/profiles/index/') import('./pages/profiles/index')
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
......
...@@ -25,11 +25,22 @@ var NO_COMPRESSION = process.env.NO_COMPRESSION; ...@@ -25,11 +25,22 @@ var NO_COMPRESSION = process.env.NO_COMPRESSION;
var autoEntries = {}; var autoEntries = {};
var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') }); 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 ) => { pageEntries.forEach(( path ) => {
let chunkName = path.replace(/\/index\.js$/, '').replace(/\//g, '.'); let chunkPath = path.replace(/\/index\.js$/, '');
autoEntries[chunkName] = './' + path; 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 = { var config = {
// because sqljs requires fs. // because sqljs requires fs.
node: { node: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment