From 3da20697ca9715a430a8475d7fd0f90bb93d3f0c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 19 Jan 2018 01:04:05 -0800 Subject: [PATCH] reduce lodash size --- package-lock.json | 8 ++++++++ package.json | 1 + webpack.client.config.js | 2 ++ 3 files changed, 11 insertions(+) diff --git a/package-lock.json b/package-lock.json index c787faf9..17bcc6e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3795,6 +3795,14 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, + "lodash-webpack-plugin": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.4.tgz", + "integrity": "sha1-bD7Lo9S40ktTlAtjVCcVxe08SsU=", + "requires": { + "lodash": "4.17.4" + } + }, "lodash._basecallback": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/lodash._basecallback/-/lodash._basecallback-3.3.1.tgz", diff --git a/package.json b/package.json index 8e7414fb..4c58c763 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "intersection-observer": "^0.5.0", "intl-relativeformat": "^2.1.0", "lodash": "^4.17.4", + "lodash-webpack-plugin": "^0.11.4", "marky": "^1.2.0", "node-fetch": "^1.7.3", "node-sass": "^4.7.2", diff --git a/webpack.client.config.js b/webpack.client.config.js index b5cd8848..a7b5df81 100644 --- a/webpack.client.config.js +++ b/webpack.client.config.js @@ -3,6 +3,7 @@ const config = require('sapper/webpack/config.js') const ExtractTextPlugin = require('extract-text-webpack-plugin') const UglifyJSPlugin = require('uglifyjs-webpack-plugin') const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin +var LodashModuleReplacementPlugin = require('lodash-webpack-plugin') const isDev = config.dev; @@ -63,6 +64,7 @@ module.exports = { }), /* disable while https://github.com/sveltejs/sapper/issues/79 is open */ //new ExtractTextPlugin('main.css'), + new LodashModuleReplacementPlugin(), new webpack.optimize.ModuleConcatenationPlugin(), new UglifyJSPlugin(), new BundleAnalyzerPlugin({ // generates report.html and stats.json