Commit b8d79cc4 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'fix-webpack-chunk-naming' into 'master'

Properly name webpack chunks for dynamic imports

See merge request gitlab-org/gitlab-ce!16066
parents 92e15071 c46f7b2a
...@@ -110,6 +110,8 @@ import Activities from './activities'; ...@@ -110,6 +110,8 @@ import Activities from './activities';
return false; return false;
} }
const fail = () => Flash('Error loading dynamic module');
path = page.split(':'); path = page.split(':');
shortcut_handler = null; shortcut_handler = null;
...@@ -540,7 +542,7 @@ import Activities from './activities'; ...@@ -540,7 +542,7 @@ import Activities from './activities';
new CILintEditor(); new CILintEditor();
break; break;
case 'users:show': case 'users:show':
new UserCallout(); import('./pages/users/show').then(m => m.default()).catch(fail);
break; break;
case 'admin:conversational_development_index:show': case 'admin:conversational_development_index:show':
new UserCallout(); new UserCallout();
......
import UserCallout from '~/user_callout';
export default () => new UserCallout();
...@@ -176,8 +176,13 @@ var config = { ...@@ -176,8 +176,13 @@ var config = {
return chunk.name; return chunk.name;
} }
return chunk.mapModules((m) => { return chunk.mapModules((m) => {
var chunkPath = m.request.split('!').pop(); const pagesBase = path.join(ROOT_PATH, 'app/assets/javascripts/pages');
return path.relative(m.context, chunkPath); if (m.resource.indexOf(pagesBase) === 0) {
return path.relative(pagesBase, m.resource)
.replace(/\/index\.[a-z]+$/, '')
.replace(/\//g, '__');
}
return path.relative(m.context, m.resource);
}).join('_'); }).join('_');
}), }),
......
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