From 143d80c94ec0b4169fa44842c3fe61c9a864740f Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 24 Mar 2018 18:17:55 -0700 Subject: [PATCH] tweak webpack config to make it faster and more correct --- webpack.client.config.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/webpack.client.config.js b/webpack.client.config.js index bd70840..8dcfefd 100644 --- a/webpack.client.config.js +++ b/webpack.client.config.js @@ -9,7 +9,7 @@ module.exports = { entry: config.client.entry(), output: config.client.output(), resolve: { - extensions: ['.js', '.html'] + extensions: ['.js', '.json', '.html'] }, mode: isDev ? 'development' : 'production', module: { @@ -36,11 +36,6 @@ module.exports = { }, !isDev && { test: /\.css$/, - /* disable while https://github.com/sveltejs/sapper/issues/79 is open */ - /* use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [{ loader: 'css-loader', options: { sourceMap:isDev } }] - }) */ use: [ { loader: 'style-loader' }, { loader: 'css-loader' } @@ -51,19 +46,18 @@ module.exports = { node: { setImmediate: false }, - plugins: isDev ? [ + plugins: [ + new LodashModuleReplacementPlugin({ + collections: true, + caching: true + }) + ].concat(isDev ? [ new webpack.HotModuleReplacementPlugin() ] : [ new webpack.DefinePlugin({ 'process.browser': true, 'process.env.NODE_ENV': '"production"' }), - /* disable while https://github.com/sveltejs/sapper/issues/79 is open */ - // new ExtractTextPlugin('main.css'), - new LodashModuleReplacementPlugin({ - collections: true, - caching: true - }), new BundleAnalyzerPlugin({ // generates report.html and stats.json analyzerMode: 'static', generateStatsFile: true, @@ -74,6 +68,6 @@ module.exports = { openAnalyzer: false, logLevel: 'silent' // do not bother Webpacker, who runs with --json and parses stdout }) - ], - devtool: isDev ? 'cheap-module-source-map' : 'source-map' + ]), + devtool: isDev ? 'cheap-module-eval-source-map' : 'source-map' }