vue.config.js
通过配置 externals 实现打生产包时排除某些依赖,使用 cdn 资源代替。
externals: {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
// 'axios': 'axios',
// 'lodash': '_',
// 'qs': 'Qs',
// 'crypto-js': 'CryptoJS',
// 'babel-polyfill': 'babel-polyfill',
// 'es6-promise': 'es6-promise',
// 'vue-lazyload': 'VueLazyload',
},
postcss.config.js
配置px 转rem 和自动补全前缀
module.exports = {
"plugins": {
"autoprefixer": {},
"postcss-import": {},
'autoprefixer': {
browsers: ['Android >= 4.0', 'iOS >= 7']
},
'postcss-pxtorem': {
rootValue: 19,
propList: ['*']
}
}
}