标签:plugins ack exp page mic rod dynamic 开启 动态
1、先安装 babel 动态引入插件
npm install --save-dev babel-plugin-syntax-dynamic-import
2、修改router/index.js
异步引入组件
import Vue from ‘vue‘;
import Router from ‘vue-router‘;
const index = () => import(‘@/pages-phone/index‘);
const LOG = [
{
path: ‘/index‘,
name: ‘index‘,
component: index,
},
];
Vue.use(Router);
export default new Router({
routes: [
...LOG,
],
});
3、修改 .babelrc 文件
"plugins": [
"syntax-dynamic-import"
],
二、开启gzip压缩
1、安装 gzip 压缩插件
npm install --save-dev compression-webpack-plugin
2、修改 config/index.js 文件
// ...
productionGzip: true,
// ...
标签:plugins ack exp page mic rod dynamic 开启 动态
原文地址:https://www.cnblogs.com/goloving/p/9157980.html