feat: 前端工程打包优化 (#14)

This commit is contained in:
dayou 2023-12-01 16:13:51 +08:00 committed by GitHub
parent 7769bef84b
commit 851c89f593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 129 additions and 73 deletions

View File

@ -8,9 +8,9 @@
"build": "tsc", "build": "tsc",
"launch:local": "npm run build && SERVER_ENV=local node ./build/index.js", "launch:local": "npm run build && SERVER_ENV=local node ./build/index.js",
"launch:dev": "npm run build && SERVER_ENV=dev node ./build/index.js", "launch:dev": "npm run build && SERVER_ENV=dev node ./build/index.js",
"start:stable": "npm run copy && npm run build && SERVER_ENV=stable node ./build/index.js", "start:stable": "SERVER_ENV=stable node ./build/index.js",
"start:preonline": "npm run copy && npm run build && SERVER_ENV=preonline node ./build/index.js", "start:preonline": "SERVER_ENV=preonline node ./build/index.js",
"start:online": "npm run copy && npm run build && SERVER_ENV=online node ./build/index.js", "start:online": "SERVER_ENV=online node ./build/index.js",
"start": "npm run start:online", "start": "npm run start:online",
"local": "npm run copy && nodemon -e js,mjs,json,ts --exec 'npm run launch:local' --watch ./src", "local": "npm run copy && nodemon -e js,mjs,json,ts --exec 'npm run launch:local' --watch ./src",
"dev": "npm run copy && nodemon -e js,mjs,json,ts --exec 'npm run launch:dev' --watch ./src" "dev": "npm run copy && nodemon -e js,mjs,json,ts --exec 'npm run launch:dev' --watch ./src"

View File

@ -57,7 +57,7 @@ export default class SurveyPublish {
await surveySubmitService.submit({ surveySubmitData }) await surveySubmitService.submit({ surveySubmitData })
return { return {
code: 200, code: 200,
msg: "报名成功", msg: "提交成功",
} }
} }
} }

View File

@ -5,6 +5,7 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"report": "vue-cli-service build --report",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"lintfix": "eslint --fix ." "lintfix": "eslint --fix ."
}, },
@ -12,7 +13,6 @@
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0", "@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/babel-preset-jsx": "^1.4.0", "@vue/babel-preset-jsx": "^1.4.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "1.0.2",
"axios": "^1.4.0", "axios": "^1.4.0",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"core-js": "^3.8.3", "core-js": "^3.8.3",
@ -46,7 +46,8 @@
"sass-loader": "^12.0.0", "sass-loader": "^12.0.0",
"style-resources-loader": "^1.5.0", "style-resources-loader": "^1.5.0",
"vue-style-loader": "^4.1.3", "vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.7.14" "vue-template-compiler": "^2.7.14",
"speed-measure-webpack-plugin": "^1.5.0"
}, },
"engines": { "engines": {
"node": ">=14.21.0", "node": ">=14.21.0",

View File

@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import store from '@/management/store/index'; import store from '@/management/store/index';
import router from '@/management/router/index'; import router from '@/management/router/index';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
const instance = axios.create({ const instance = axios.create({

View File

@ -23,7 +23,7 @@ import history from '../modules/contentModule/history.vue';
import save from '../modules/contentModule/save.vue'; import save from '../modules/contentModule/save.vue';
import publish from '../modules/contentModule/publish.vue'; import publish from '../modules/contentModule/publish.vue';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'navbar', name: 'navbar',

View File

@ -1,5 +1,4 @@
import _pick from 'lodash/pick'; import { pick as _pick, get as _get } from 'lodash';
import _get from 'lodash/get';
// 生成需要保存到接口的数据 // 生成需要保存到接口的数据
export default function (schema) { export default function (schema) {

View File

@ -25,8 +25,13 @@
<script> <script>
import { getSurveyHistory } from '@/management/api/survey'; import { getSurveyHistory } from '@/management/api/survey';
import moment from 'moment'; import moment from 'moment';
//
import 'moment/locale/zh-cn'
//
moment.locale('zh-cn');
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
const getItemData = (item) => ({ const getItemData = (item) => ({
operator: item?.operator?.username || '未知用户', operator: item?.operator?.username || '未知用户',

View File

@ -12,7 +12,7 @@
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import { publishSurvey, saveSurvey } from '@/management/api/survey'; import { publishSurvey, saveSurvey } from '@/management/api/survey';
import buildData from './buildData'; import buildData from './buildData';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'publish', name: 'publish',
data() { data() {

View File

@ -17,7 +17,7 @@
import { saveSurvey } from '@/management/api/survey'; import { saveSurvey } from '@/management/api/survey';
import buildData from './buildData'; import buildData from './buildData';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import _get from 'lodash/get'; import { get as _get} from 'lodash';
export default { export default {
name: 'save', name: 'save',

View File

@ -22,7 +22,7 @@
</div> </div>
</template> </template>
<script> <script>
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'banner', name: 'banner',

View File

@ -32,9 +32,7 @@
</el-form> </el-form>
</template> </template>
<script> <script>
import _get from 'lodash/get'; import { get as _get, pick as _pick, isFunction as _isFunction } from 'lodash';
import _pick from 'lodash/pick';
import _isFunction from 'lodash/isFunction';
import FormItem from '@/materials/setters/widgets/FormItem.vue'; import FormItem from '@/materials/setters/widgets/FormItem.vue';
import setterLoader from '@/materials/setters/setterLoader'; import setterLoader from '@/materials/setters/setterLoader';

View File

@ -46,7 +46,7 @@ import questionMenuConfig, {
} from '@/management/config/questionMenuConfig'; } from '@/management/config/questionMenuConfig';
import { getQuestionByType } from '@/management/utils/index'; import { getQuestionByType } from '@/management/utils/index';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'QuestionTypeList', name: 'QuestionTypeList',

View File

@ -39,14 +39,13 @@
</template> </template>
<script> <script>
// import _cloneDeep from 'lodash/cloneDeep'
import materialGroup from './components/materialGroup.vue'; import materialGroup from './components/materialGroup.vue';
import banner from './components/banner.vue'; import banner from './components/banner.vue';
import mainTitle from './components/mainTitle.vue'; import mainTitle from './components/mainTitle.vue';
import submit from './components/submit.vue'; import submit from './components/submit.vue';
import logo from './components/logo.vue'; import logo from './components/logo.vue';
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'mainOperation', name: 'mainOperation',

View File

@ -14,7 +14,7 @@ import { mapState } from 'vuex';
import success from './components/success'; import success from './components/success';
import overTime from './components/overTime'; import overTime from './components/overTime';
import { EDIT_STATUS_MAP } from './enum'; import { EDIT_STATUS_MAP } from './enum';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
export default { export default {
name: 'ResultConfigPreivew', name: 'ResultConfigPreivew',

View File

@ -28,8 +28,7 @@ import FormItem from '@/materials/setters/widgets/FormItem.vue';
import setterLoader from '@/materials/setters/setterLoader'; import setterLoader from '@/materials/setters/setterLoader';
import statusConfig from './config/statusConfig'; import statusConfig from './config/statusConfig';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import _get from 'lodash/get'; import { get as _get, pick as _pick } from 'lodash';
import _pick from 'lodash/set';
const textMap = { const textMap = {
Success: '提交成功页面配置', Success: '提交成功页面配置',

View File

@ -44,9 +44,7 @@ import baseConfig from './config/baseConfig';
import baseFormConfig from './config/baseFormConfig'; import baseFormConfig from './config/baseFormConfig';
import FormItem from '@/materials/setters/widgets/FormItem.vue'; import FormItem from '@/materials/setters/widgets/FormItem.vue';
import setterLoader from '@/materials/setters/setterLoader'; import setterLoader from '@/materials/setters/setterLoader';
import _cloneDeep from 'lodash/cloneDeep'; import { cloneDeep as _cloneDeep, isArray as _isArray, get as _get } from 'lodash';
import _isArray from 'lodash/isArray';
import _get from 'lodash/get';
export default { export default {
name: 'QuestionConfig', name: 'QuestionConfig',

View File

@ -71,8 +71,12 @@
</template> </template>
<script> <script>
import _ from 'lodash'; import { get, map } from 'lodash';
import moment from 'moment'; import moment from 'moment';
//
import 'moment/locale/zh-cn'
//
moment.locale('zh-cn');
import empty from '@/management/components/empty'; import empty from '@/management/components/empty';
import ModifyDialog from './modify'; import ModifyDialog from './modify';
import Tag from './tag'; import Tag from './tag';
@ -99,8 +103,8 @@ export default {
}, },
computed: { computed: {
fieldList() { fieldList() {
const fieldInfo = _.map(this.fields, (f) => { const fieldInfo = map(this.fields, (f) => {
return _.get(fieldConfig, f, null); return get(fieldConfig, f, null);
}); });
return fieldInfo; return fieldInfo;
}, },
@ -132,14 +136,14 @@ export default {
} }
}, },
lget(row, field) { lget(row, field) {
const data = _.get(row, field.key); const data = get(row, field.key);
if (field.key === 'updateDate') { if (field.key === 'updateDate') {
return moment(data).format('YYYY-MM-DD HH:mm:ss'); return moment(data).format('YYYY-MM-DD HH:mm:ss');
} }
return data; return data;
}, },
getStatus(data) { getStatus(data) {
return _.get(data, 'curStatus.id', 'new'); return get(data, 'curStatus.id', 'new');
}, },
getToolConfig() { getToolConfig() {
const funcList = [ const funcList = [

View File

@ -34,7 +34,7 @@
<script> <script>
import { CODE_MAP } from '@/management/api/base'; import { CODE_MAP } from '@/management/api/base';
import { updateSurvey } from '@/management/api/survey'; import { updateSurvey } from '@/management/api/survey';
import _pick from 'lodash/pick'; import { pick as _pick } from 'lodash';
export default { export default {
name: 'modifyDialog', name: 'modifyDialog',

View File

@ -30,7 +30,7 @@
<script> <script>
import ChannelRow from './components/channelRow'; import ChannelRow from './components/channelRow';
import empty from '@/management/components/empty'; import empty from '@/management/components/empty';
import _get from 'lodash/get'; import { get as _get } from 'lodash';
import leftMenu from '@/management/components/leftMenu.vue'; import leftMenu from '@/management/components/leftMenu.vue';
import { mapState } from 'vuex'; import { mapState } from 'vuex';

View File

@ -11,7 +11,7 @@ const routes = [
{ {
path: '/survey', path: '/survey',
name: 'survey', name: 'survey',
component: () => import('../pages/list/index.vue'), component: () => import(/* webpackChunkName: "survey" */'../pages/list/index.vue'),
meta: { meta: {
needLogin: true, needLogin: true,
title: '问卷列表', title: '问卷列表',
@ -23,7 +23,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/edit/index.vue'), component: () => import(/* webpackChunkName: "editPage" */'../pages/edit/index.vue'),
children: [ children: [
{ {
path: '', path: '',
@ -31,7 +31,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/edit/pages/edit.vue'), component: () => import(/* webpackChunkName: "QuestionEditIndex" */'../pages/edit/pages/edit.vue'),
}, },
{ {
path: 'setting', path: 'setting',
@ -39,7 +39,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/edit/pages/setting.vue'), component: () => import(/* webpackChunkName: "QuestionEditSetting" */'../pages/edit/pages/setting.vue'),
}, },
{ {
path: 'resultConfig', path: 'resultConfig',
@ -47,7 +47,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/edit/pages/resultConfig.vue'), component: () => import(/* webpackChunkName: "QuestionEditResultConfig" */'../pages/edit/pages/resultConfig.vue'),
}, },
], ],
}, },
@ -57,7 +57,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/analysis/index.vue'), component: () => import(/* webpackChunkName: "analysisPage" */'../pages/analysis/index.vue'),
}, },
{ {
path: '/survey/:id/publishResult', path: '/survey/:id/publishResult',
@ -65,7 +65,7 @@ const routes = [
meta: { meta: {
needLogin: true, needLogin: true,
}, },
component: () => import('../pages/publishResult/index.vue'), component: () => import(/* webpackChunkName: "publishResultPage" */'../pages/publishResult/index.vue'),
}, },
{ {
path: '/create', path: '/create',
@ -74,13 +74,13 @@ const routes = [
needLogin: true, needLogin: true,
title: '创建问卷', title: '创建问卷',
}, },
component: () => import('../pages/create/index.vue'), component: () => import(/* webpackChunkName: "create" */'../pages/create/index.vue'),
}, },
{ {
path: '/login', path: '/login',
name: 'login', name: 'login',
title: '登陆', title: '登陆',
component: () => import('../pages/login/index.vue'), component: () => import(/* webpackChunkName: "login" */'../pages/login/index.vue'),
}, },
]; ];

View File

@ -1,7 +1,6 @@
import { getNewField } from '@/management/utils'; import { getNewField } from '@/management/utils';
import _cloneDeep from 'lodash/cloneDeep'; import { cloneDeep as _cloneDeep, get as _get } from 'lodash';
import { getSurveyById } from '@/management/api/survey'; import { getSurveyById } from '@/management/api/survey';
import _get from 'lodash/get';
export default { export default {
init({ state, dispatch }) { init({ state, dispatch }) {

View File

@ -1,5 +1,4 @@
import _set from 'lodash/set'; import { set as _set, merge as _merge } from 'lodash';
import _merge from 'lodash/merge';
export default { export default {
setCurrentEditOne(state, data) { setCurrentEditOne(state, data) {

View File

@ -1,6 +1,5 @@
import { defaultQuestionConfig } from '../config/questionConfig'; import { defaultQuestionConfig } from '../config/questionConfig';
import _cloneDeep from 'lodash/cloneDeep'; import { cloneDeep as _cloneDeep, map as _map } from 'lodash';
import _map from 'lodash/map';
const generateQuestionField = () => { const generateQuestionField = () => {
const num = Math.floor(Math.random() * 1000); const num = Math.floor(Math.random() * 1000);

View File

@ -1,4 +1,4 @@
import _pick from 'lodash/pick'; import { pick as _pick } from 'lodash';
export default { export default {
name: 'basicConfig', name: 'basicConfig',

View File

@ -1,5 +1,4 @@
import _forEach from 'lodash/forEach'; import { forEach as _forEach, trim as _trim } from 'lodash';
import _trim from 'lodash/trim';
import { escapeFilterXSS } from '@/common/xss'; import { escapeFilterXSS } from '@/common/xss';
// 获取选项的hash // 获取选项的hash

View File

@ -87,8 +87,7 @@
<script> <script>
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
import _forEach from 'lodash/forEach'; import { forEach as _forEach, cloneDeep as _cloneDeep } from 'lodash';
import _cloneDeep from 'lodash/cloneDeep';
import ExtraIcon from '../ExtraIcon'; import ExtraIcon from '../ExtraIcon';
import { cleanRichText } from '@/common/xss'; import { cleanRichText } from '@/common/xss';

View File

@ -48,7 +48,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import _get from 'lodash/get'; import { get as _get } from 'lodash';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
props: { props: {

View File

@ -43,7 +43,7 @@
<script> <script>
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import _cloneDeep from 'lodash/cloneDeep'; import { cloneDeep as _cloneDeep } from 'lodash';
import EditorV2 from '@/common/Editor/EditorV2'; import EditorV2 from '@/common/Editor/EditorV2';
export default { export default {

View File

@ -24,7 +24,7 @@
</el-form-item> </el-form-item>
</template> </template>
<script> <script>
import _get from 'lodash/get'; import { get as _get } from 'lodash';
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'; import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant';
export default { export default {
name: 'FreqAndNumberLimit', name: 'FreqAndNumberLimit',

View File

@ -22,6 +22,10 @@
<script> <script>
// elementformatmomentformatD // elementformatmomentformatD
import moment from 'moment'; import moment from 'moment';
//
import 'moment/locale/zh-cn'
//
moment.locale('zh-cn');
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'; import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant';
export default { export default {
name: 'QuestionTime', name: 'QuestionTime',

View File

@ -14,6 +14,10 @@
</template> </template>
<script> <script>
import moment from 'moment'; import moment from 'moment';
//
import 'moment/locale/zh-cn'
//
moment.locale('zh-cn');
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'; import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant';
export default { export default {

View File

@ -1,4 +1,4 @@
import _cloneDeep from 'lodash/cloneDeep'; import { cloneDeep as _cloneDeep } from 'lodash';
export default class ComponentLoader { export default class ComponentLoader {
constructor(options = {}) { constructor(options = {}) {
const { componentList, lifeCycle } = options; const { componentList, lifeCycle } = options;

View File

@ -2,8 +2,7 @@
* 处理单题的配置 * 处理单题的配置
*/ */
import _get from 'lodash/get'; import { get as _get, map as _map } from 'lodash';
import _map from 'lodash/map';
// 处理选择题的options // 处理选择题的options
function handleOptions(item) { function handleOptions(item) {

View File

@ -1,5 +1,4 @@
import _get from 'lodash/get'; import { get as _get, last as _last } from 'lodash';
import _last from 'lodash/last';
export default function handleQuestionSeq(questionConfig) { export default function handleQuestionSeq(questionConfig) {
const dataList = _get(questionConfig, 'dataConf.dataList', []); const dataList = _get(questionConfig, 'dataConf.dataList', []);

View File

@ -1,8 +1,4 @@
import _forEach from 'lodash/forEach'; import { forEach as _forEach, get as _get, isArray as _isArray, keys as _keys, set as _set } from 'lodash';
import _get from 'lodash/get';
import _isArray from 'lodash/isArray';
import _keys from 'lodash/keys';
import _set from 'lodash/set';
const regexpMap = { const regexpMap = {
nd: /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/, nd: /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/,

View File

@ -45,7 +45,7 @@
</div> </div>
</template> </template>
<script> <script>
import _get from 'lodash/get'; import { get as _get} from 'lodash';
import { formatLink } from '../utils/index.js'; import { formatLink } from '../utils/index.js';
export default { export default {

View File

@ -1,7 +1,7 @@
import confirm from '../../components/confirm.vue'; import confirm from '../../components/confirm.vue';
import alert from '../../components/alert.vue'; import alert from '../../components/alert.vue';
import _isFunction from 'lodash/isFunction'; import { isFunction as _isFunction} from 'lodash';
export default { export default {
install(Vue) { install(Vue) {

View File

@ -1,4 +1,8 @@
import moment from 'moment'; import moment from 'moment';
// 引入中文
import 'moment/locale/zh-cn'
// 设置中文
moment.locale('zh-cn');
import adapter from '../adapter'; import adapter from '../adapter';
import { queryVote, getEncryptInfo } from '@/render/api/survey'; import { queryVote, getEncryptInfo } from '@/render/api/survey';
import { CODE_MAP } from '@/management/api/base'; import { CODE_MAP } from '@/management/api/base';

View File

@ -1,4 +1,8 @@
const { defineConfig } = require('@vue/cli-service'); const { defineConfig } = require('@vue/cli-service');
const Webpack = require('webpack')
// 分析打包时间
const SpeedMeasureWebpackPlugin = require('speed-measure-webpack-plugin')
module.exports = defineConfig({ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
@ -42,10 +46,16 @@ module.exports = defineConfig({
}, },
open: true, open: true,
}, },
configureWebpack: {
plugins: [new Webpack.IgnorePlugin({resourceRegExp: /^\.\/locale$/, contextRegExp: /moment$/ })],
},
chainWebpack: (config) => { chainWebpack: (config) => {
config.module config.module
.rule('js') .rule('js')
.test(/\.jsx?$/) .test(/\.jsx?$/)
.exclude
.add(/node_modules/)
.end()
.use('babel-loader') .use('babel-loader')
.loader('babel-loader') .loader('babel-loader')
.end(); .end();
@ -53,18 +63,60 @@ module.exports = defineConfig({
config.optimization.splitChunks({ config.optimization.splitChunks({
cacheGroups: { cacheGroups: {
setterWidgets: { setterWidgets: {
name: 'setterWidgets', name: 'chunk-setterWidgets',
test: /\/setters\/src\/widgets[\\/]/, test: /\/materials\/setters[\\/]/,
chunks: 'async', chunks: 'async',
enforce: true, enforce: true,
}, },
materialWidgets: { materialWidgets: {
name: 'materialWidgets', name: 'chunk-materialWidgets',
test: /\/materials\/questions\/widgets[\\/]/, test: /\/materials\/questions[\\/]/,
chunks: 'async', chunks: 'async',
enforce: true, enforce: true,
}, },
commonEditor: {
name: 'chunk-commonEditor',
test: /\/common\/Editor[\\/]/,
enforce: true,
},
element: {
name: 'chunk-element-ui',
test: /[\\/]node_modules[\\/]element-ui[\\/]/,
chunks: "all",
priority: 3,
reuseExistingChunk: true,
enforce: true
},
moment: {
name: 'chunk-moment',
test: /[\\/]node_modules[\\/]moment[\\/]/,
chunks: "all",
priority: 3,
reuseExistingChunk: true,
enforce: true
},
'@wangeditor': {
name: 'chunk-wangeditor',
test: /[\\/]node_modules[\\/]@wangeditor[\\/]/,
chunks: "all",
priority: 3,
reuseExistingChunk: true,
enforce: true
},
common: {
//抽取所有入口页面都需要的公共chunk
name: "chunk-common",
chunks: "initial",
minChunks: 2,
maxInitialRequests: 5,
minSize: 0,
priority: 1,
reuseExistingChunk: true,
enforce: true
}
}, },
}); });
config.plugin('speed')
.use(SpeedMeasureWebpackPlugin)
}, },
}); });