安装开源的iview-admin时报错
npm ERR! Could not resolve dependency:
npm ERR! peer less@"^2.3.1 || ^3.0.0" from less-loader@4.1.0
原因是版本不匹配,
package.json部分修改成
"less": "^3.9.0",
"less-loader": "^4.0.5",
npm config set registry https://registry.npm.taobao.org
又出现报错
error in ./src/index.less
Syntax Error:
// https://github.com/ant-design/ant-motion/issues/44
.bezierEasingMixin();
vue.config.js 部分改为
module.exports = {
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
publicPath: BASE_URL,
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave: true,
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
},
// 设为false打包时不生成.map文件
productionSourceMap: false,
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'localhost:3000'
// }
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
}
}