Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

vue打包报错

vue打包在第一次进入系统总是有js资源报404错误;
刷新就没事了不租断流程;
本地环境自己打包没遇见过;

有遇到过的小伙伴吗?(是环境的原因吗? 我本地自己打包没遇到过! 不好复现啊)
微信截图_20200608101741.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

webpack配置有问题,打包后,静态资源读取路径配置:

vue2.0配置路径:

// config/index.js

build: {
    assetsPublicPath: '/xx/',
}

vue3.0配置路径:

// vue.config.js

module.exports = {
    baseUrl: process.env.NODE_ENV === 'production' ? '/xx/' : './';
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...