Last active
February 27, 2019 14:10
-
-
Save adamhenson/96ff7e07239d890a157e407863977d0b to your computer and use it in GitHub Desktop.
Revisions
-
adamhenson revised this gist
Feb 27, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ import webpack from 'webpack'; import path from 'path'; const common = { // imagine your configuration here -
adamhenson revised this gist
Feb 21, 2019 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ import webpack from 'webpack'; const common = { // imagine your configuration here }; @@ -40,6 +42,9 @@ export default { plugins: [ // this is too... new LoadablePlugin(), new webpack.DefinePlugin({ LOADABLE_STATS: JSON.stringify(path.resolve(__dirname, '../build/loadable-stats.json')), }), ...common.plugins, ], optimization: { -
adamhenson revised this gist
Feb 21, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,5 +42,11 @@ export default { new LoadablePlugin(), ...common.plugins, ], optimization: { // https://webpack.js.org/plugins/split-chunks-plugin/#optimization-splitchunks splitChunks: { chunks: 'all', }, }, ...common, }; -
adamhenson revised this gist
Feb 21, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,8 +38,9 @@ export default { ], }, plugins: [ // this is too... new LoadablePlugin(), ...common.plugins, ], ...common, }; -
adamhenson revised this gist
Feb 21, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,11 +3,11 @@ const common = { }; const plugins = [ // imagine your Babel plugins here ]; const presets = [ // imagine your Babel presets here ]; export default { -
adamhenson created this gist
Feb 21, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ const common = { // imagine your configuration here }; const plugins = [ // imagine your presets here ]; const presets = [ // imagine your presets here ]; export default { entry: [ '@babel/polyfill', './src/client', ], module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: [ { loader: 'babel-loader', options: { plugins: [ // this is the important part... '@loadable/babel-plugin', ...plugins, ], presets, }, }, ], }, ...common.plugins.module.rules, ], }, plugins: [ ...common.plugins, new LoadablePlugin(), ], ...common, };