1.打包的路径
config文件夹-index.js中的assetsPublicPath: './'要改为当前目录而不是'/'根目录
build: {env: require('./prod.env'),index: path.resolve(__dirname,'../dist/index.html'),assetsRoot: path.resolve(__dirname,'../dist'),assetsSubDirectory:'static',assetsPublicPath:'./',productionSourceMap:true,
2.模式要去掉,不能使用html5的Historty模式
constrouter =newVueRouter({// mode: 'history',//打包项目要把mode: history注释掉routes// (缩写)相当于 routes: routes})
3.引入字体图标,比如font-awesome的图标路径出错, 在webpack.base.conf.js里面修改limit要改大,把10000改为90000
test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/,loader:'url-loader',options: {limit:90000,name: utils.assetsPath('fonts/[name].[hash:7].[ext]')}
原文链接