mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Merge pull request #5719 from paulkaplan/dynamic-import
Support dynamic imports to load code only when needed
This commit is contained in:
commit
5610e1b217
5 changed files with 13 additions and 4 deletions
3
.babelrc
3
.babelrc
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"plugins": [
|
||||
"transform-object-rest-spread",
|
||||
"transform-require-context"
|
||||
"transform-require-context",
|
||||
"syntax-dynamic-import"
|
||||
],
|
||||
"presets": ["es2015", "react"],
|
||||
}
|
||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -3396,6 +3396,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": {
|
||||
"version": "6.18.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz",
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
"babel-core": "6.23.1",
|
||||
"babel-eslint": "10.0.3",
|
||||
"babel-loader": "7.1.0",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"babel-plugin-transform-object-rest-spread": "6.26.0",
|
||||
"babel-plugin-transform-require-context": "0.1.1",
|
||||
"babel-preset-es2015": "6.22.0",
|
||||
|
|
|
@ -59,11 +59,11 @@
|
|||
<div id="app"></div>
|
||||
|
||||
<!-- Vendor & Initialize (Session & Localization)-->
|
||||
<script src="/<%= htmlWebpackPlugin.files.chunks.common.entry %>"></script>
|
||||
<script src="<%= htmlWebpackPlugin.files.chunks.common.entry %>"></script>
|
||||
|
||||
<!-- Scripts -->
|
||||
<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 -->
|
||||
<% if (!htmlWebpackPlugin.options.dynamicMetaTags) { %>
|
||||
|
|
|
@ -72,7 +72,8 @@ module.exports = {
|
|||
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'js/[name].bundle.js'
|
||||
filename: 'js/[name].bundle.js',
|
||||
publicPath: '/'
|
||||
},
|
||||
resolve: {
|
||||
symlinks: false // Fix local development with `npm link` packages
|
||||
|
|
Loading…
Reference in a new issue