美文网首页
vue.js使用vue-cli打包遇到的坑,问题

vue.js使用vue-cli打包遇到的坑,问题

作者: hh_2ad9 | 来源:发表于2017-09-27 10:34 被阅读0次

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]')}

原文链接

相关文章

网友评论

      本文标题: vue.js使用vue-cli打包遇到的坑,问题

      本文链接:https://www.haomeiwen.com/subject/mpwyextx.html