ensure dynamic imports use proper path/url

This commit is contained in:
Wyatt Johnson
2018-01-31 10:57:01 -07:00
parent 8b6a993587
commit 062ce58cf8
4 changed files with 37 additions and 29 deletions
+10 -4
View File
@@ -54,7 +54,7 @@ const config = {
target: 'web',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/static/',
publicPath: '',
filename: '[name].js',
chunkFilename: '[name].chunk.js',
},
@@ -249,13 +249,19 @@ const applyConfig = (entries, root = {}) =>
config,
{
entry: entries.reduce(
(entry, { name, path, disablePolyfill = false }) => {
(entry, { name, path: modulePath, disablePolyfill = false }) => {
const entries = [
path.join(__dirname, 'client/coral-framework/helpers/publicPath'),
];
if (disablePolyfill) {
entry[name] = path;
entries.push(modulePath);
} else {
entry[name] = ['babel-polyfill', path];
entries.unshift('babel-polyfill');
entries.push(modulePath);
}
entry[name] = entries;
return entry;
},
{}