Vue CLI2升级至Vue CLI3的方法步骤

2020-06-13 10:35:13易采站长站整理
文件增加如下配置:


module.exports = {
...

configureWebpack: {
externals: {
"echarts": "echarts",
}
},

...
}

即可在需要的地方按如下方式使用了:


import echarts from 'echarts';

11. 忽略编译文件大小限制警告

当执行

npm run build
时,会出现警告信息:

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

此时,我们可以在

vue.config.js
中添加如下配置,忽略这条警告信息:


module.exports = {
...

performance: {
hints: false
}

...
};