From a267fc3ec12aa205c9fcd8b3c861178b1150b6fe Mon Sep 17 00:00:00 2001 From: ronger Date: Wed, 12 Aug 2020 17:22:23 +0800 Subject: [PATCH] =?UTF-8?q?:alembic:=20=E7=BD=91=E9=A1=B5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=80=9F=E5=BA=A6=E4=BC=98=E5=8C=96=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nuxt.config.js | 12 ++++++++++++ package.json | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nuxt.config.js b/nuxt.config.js index 9a66310..012ef54 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,6 +1,7 @@ import appConfig from './config/app.config' import apiConfig from './config/api.config' import {isDevMode} from './environment' +const LodashModuleReplacementPlugin = require('lodash-webpack-plugin') export default { /* @@ -86,5 +87,16 @@ export default { */ build: { transpile: [/^element-ui/], + optimization: { + splitChunks: { + minSize: 10000, + maxSize: 250000 + } + }, + extend(config, ctx) { + config.plugins.unshift(new LodashModuleReplacementPlugin()) + // rules[2].use[0] is babel-loader + config.module.rules[2].use[0].options.plugins = ['lodash'] + } } } diff --git a/package.json b/package.json index b450297..2812da7 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,13 @@ "dev": "nuxt", "build": "nuxt build", "start": "nuxt start", - "generate": "nuxt generate" + "generate": "nuxt generate", + "analyze": "nuxt build -a" }, "dependencies": { "@chenfengyuan/vue-qrcode": "^1.0.2", "@nuxtjs/axios": "^5.12.1", + "babel-plugin-lodash": "^3.3.4", "cookieparser": "^0.1.0", "echarts": "^4.8.0", "element-ui": "^2.13.2", @@ -25,6 +27,7 @@ }, "devDependencies": { "@nuxtjs/proxy": "^2.0.1", + "lodash-webpack-plugin": "^0.11.5", "node-sass": "^4.14.1", "sass-loader": "^9.0.3" }