鍍金池/ 問答/HTML/ vue打包上線之后 為什么會報webpackJsonp錯誤 JSONP不是跨域用

vue打包上線之后 為什么會報webpackJsonp錯誤 JSONP不是跨域用的嗎

我的PC端的vue項目打包上線之后 控制臺報ReferenceError: webpackJsonp is not defined錯誤 之前都沒這個問題 今天就現(xiàn)出了
不太明白JSONP不是跨域用的嗎 我沒有用到跨域 查了一下 說是用了CommonsChunkPlugin的問題 說是生成了公共文件但是沒有在頁面引入 看了關(guān)于也沒有看明白是在哪個頁面引入哪個公共文件
這是webpack.prod.conf.js文件的代碼 我這是生成了哪個公共文件呀
new webpack.optimize.CommonsChunkPlugin({

  name: 'vendor',
  minChunks: function (module) {
    // any required modules inside node_modules are extracted to vendor
    return (
      module.resource &&
      /\.js$/.test(module.resource) &&
      module.resource.indexOf(
        path.join(__dirname, '../node_modules')
      ) === 0
    )
  }
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
  name: 'manifest',
  minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
  name: 'app',
  async: 'vendor-async',
  children: true,
  minChunks: 3
}),

這是打包之后的文件 應(yīng)該不是在打包之后的index.html里引入吧 這里的代碼都是壓縮過的
圖片描述

是在項目根目錄下的index.html引入嗎 是哪個公共文件呢
圖片描述

回答
編輯回答
大濕胸

試了沒什么用啊

2017年3月31日 20:56
編輯回答
尛曖昧
解決方法: 
在 build\webpack.prod.conf.js 中 HtmlWebpackPlugin 插件里添加以下代碼改變文件加載順序
chunks: ['manifest', 'vendor', 'app'],

例: 
new HtmlWebpackPlugin({
  filename: process.env.NODE_ENV === 'testing'
    ? 'index.html'
    : config.build.index,
  template: 'index.html',
  inject: true,
  minify: {
    removeComments: true,
    collapseWhitespace: true,
    removeAttributeQuotes: true
    // more options:
    // https://github.com/kangax/html-minifier#options-quick-reference
  },
  chunks: ['manifest', 'vendor', 'app'],              --->      新增
  // necessary to consistently work with multiple chunks via CommonsChunkPlugin
  chunksSortMode: 'dependency'
}),
2017年10月25日 16:27