Webpack配置地狱
先留下参考视频:https://www.bilibili.com/video/BV15741177Eh?p=75
1、导入省略和别名设置
webpack.base.conf.js
vueCil2:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
resolve: { extensions: ['.js', '.vue', '.json'], // 文件别名 alias: { '@': resolve('src'), 'assets': resolve('src/assets'), 'components': resolve('src/components'), 'views': resolve('src/views'), } },
vueCil3:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
module.exports = { configureWebpack: { resolve: { alias: { 'assets': '@/assets', 'common': '@/common', 'components': '@/components', 'network': '@/network', 'views': '@/views', } } }, productionSourceMap: false }
在template中加~:<img slot="item-icon" src="~assets/img/tabbar/home.png" />
再script中不用加:import TabBar from "components/tabbar/TabBar";