鍍金池/ 問答/HTML/ vue 異步組件打包后原來的功能打開報錯?

vue 異步組件打包后原來的功能打開報錯?

Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined

at isESModule (vue-router.common.js:1820)
at vue-router.common.js:1749
at vue-router.common.js:1835
at <anonymous>

index.html 中引用的順序
//公共模塊
<script type="text/javascript" src="dist/js/common.js.js"></script>
//核心包
<script type="text/javascript" src="dist/js/main.js"></script>
//異步組件
<script type="text/javascript" src="dist/js/framelist.cbaa89bc.js"></script>

webpack配置

entry: {
    main: ["babel-polyfill", './src/main.js'],

},
output: {
    libraryTarget: 'umd',
    path: path.resolve(__dirname, './dist'),
    //很關(guān)鍵 決定你打包后的靜態(tài)資源是否能正確引用
    //publicPath: '/cqpt/dist/',    //打包發(fā)布
    publicPath: '/dist/',           //打包開發(fā)(不影響熱加載)
    filename: 'js/[name].js',
    chunkFilename: "js/[name].[chunkhash:8].js"
},
plugins: [
    new webpack.ProvidePlugin({
        $: 'jquery'
    }),
    new ExtractTextPlugin({
        filename: "css/styles.css",
        allChunks: true
    }),
    new HtmlWebpackPlugin({
        title: "超群網(wǎng)絡(luò)科技有限公司",
        template: "index.html",
        favicon: resolveApp('favicon.ico'),
        inject: true,
        hash: true,
        chunks:["common.js","main","framelist.cbaa89bc"],
    }),
    new webpack.optimize.CommonsChunkPlugin("common.js"),
    // new webpack.optimize.UglifyJsPlugin({
    //     compress: {
    //         warnings: false
    //     }
    // }),
],
回答
編輯回答
孤酒

看你貼 上來的代碼 .
有一半的機(jī)率是你做異步代碼分割的時候有問題..
你可以試著一行一行的注釋來檢查一下..有可能是分割的時候.js引用順序錯了

有些模塊 在index頁需要,
但代碼分割把他分到其他異步模塊去了..

2018年7月30日 15:30