Commit 8e4ee5fb authored by Paul Kaplan's avatar Paul Kaplan

feat(build): support dynamic import

add the babel plugin for dynamic import syntax and fixup the path references in webpack and template
so the chunks can be loaded dynamically
parent 8a495ee8
{ {
"plugins": [ "plugins": [
"transform-object-rest-spread", "transform-object-rest-spread",
"transform-require-context" "transform-require-context",
"syntax-dynamic-import"
], ],
"presets": ["es2015", "react"], "presets": ["es2015", "react"],
} }
...@@ -3370,6 +3370,12 @@ ...@@ -3370,6 +3370,12 @@
} }
} }
}, },
"babel-plugin-syntax-dynamic-import": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz",
"integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=",
"dev": true
},
"babel-plugin-syntax-flow": { "babel-plugin-syntax-flow": {
"version": "6.18.0", "version": "6.18.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz",
...@@ -59,11 +59,11 @@ ...@@ -59,11 +59,11 @@
<div id="app"></div> <div id="app"></div>
<!-- Vendor & Initialize (Session & Localization)--> <!-- Vendor & Initialize (Session & Localization)-->
<script src="/<%= htmlWebpackPlugin.files.chunks.common.entry %>"></script> <script src="<%= htmlWebpackPlugin.files.chunks.common.entry %>"></script>
<!-- Scripts --> <!-- Scripts -->
<script src="/js/<%= htmlWebpackPlugin.options.route.name %>.intl.js"></script> <script src="/js/<%= htmlWebpackPlugin.options.route.name %>.intl.js"></script>
<script src="/<%= htmlWebpackPlugin.files.chunks[htmlWebpackPlugin.options.route.name].entry %>"></script> <script src="<%= htmlWebpackPlugin.files.chunks[htmlWebpackPlugin.options.route.name].entry %>"></script>
<!-- Translate title element --> <!-- Translate title element -->
<% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %> <% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %>
......
...@@ -72,7 +72,8 @@ module.exports = { ...@@ -72,7 +72,8 @@ module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
output: { output: {
path: path.resolve(__dirname, 'build'), path: path.resolve(__dirname, 'build'),
filename: 'js/[name].bundle.js' filename: 'js/[name].bundle.js',
publicPath: '/'
}, },
resolve: { resolve: {
symlinks: false // Fix local development with `npm link` packages symlinks: false // Fix local development with `npm link` packages
......
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