vue-router 异步组件打包好使用报错?

vue-router.common.js:1820 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 js引用顺序
<script type="text/javascript" src="dist/js/common.js.js"></script>
<script type="text/javascript" src="dist/js/framelist.js"></script>
<script type="text/javascript" src="dist/js/main.js"></script>

//vue-router 路由中使用的异步组件代码
const FrameList= () => import(/ webpackChunkName: "framelist" /'../views/framelist/Framelist.vue').then(m => m.default);

//webpack的配置
entry: {

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

},
output: {

libraryTarget: 'umd',
path: path.resolve(__dirname, './dist'),
//很关键 决定你打包后的静态资源是否能正确引用
//publicPath: '/cqpt/dist/',    //打包发布
publicPath: '/dist/',           //打包开发(不影响热加载)
filename: 'js/[name].js',
chunkFilename: "js/[name].js"

},

plugins: [

new webpack.ProvidePlugin({
    $: 'jquery'
}),
new ExtractTextPlugin({
    filename: "css/styles.css",
    allChunks: true
}),
new HtmlWebpackPlugin({
    title: "xxxxxx",
    template: "index.html",
    favicon: resolveApp('favicon.ico'),
    inject: true,
    hash: true,
}),
new webpack.optimize.CommonsChunkPlugin("common.js"),

],

阅读 3.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏