因为写的代码需要发布到测试和生产服务器各一套,打包之后分别放在服务器的nginx目录下,但是发现一套正常能打开,但是有一套报错

Uncaught SyntaxError: Unexpected token <

vender-base.07c0f587771efee1da93.js:1 Error: Loading chunk 62 failed.
at HTMLScriptElement.n (vender-base.07c0f587771efee1da93.js:1)

vender-base.07c0f587771efee1da93.js:1 Uncaught (in promise) Error: Loading chunk 62 failed.

这时是因为服务器域名不一样,需要需要在webpack.prod.config.js文件里面修改服务器域名,

module.exports = merge(webpackBaseConfig, {
output: {
// publicPath: 'http://localhost:8004/dist/', // 修改 https://iv...admin 这部分为你的服务器域名
publicPath: 'http://192.168.8.110:8003/dist/'
filename: '[name].[hash].js',
chunkFilename: '[name].[hash].chunk.js'
},
再重新build之后发布就不报错了
posted on 2018-04-19 09:55  珞珊冉悠悠  阅读(824)  评论(0编辑  收藏  举报