您的位置:首页 > 产品设计 > UI/UE

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

2017-07-27 20:13 806 查看
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模式

const router = new VueRouter({
// 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]')
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: