vue+webpack懒加载打包时候为什么打不组件模块?

        //main.js中引用了  定义路由的js文件
        
        //异步组件
        const FrameCore = () => import('../views/form/frame/FrameCore.vue');
        {
            path: '/framecore:form?',
            component:FrameCore,
            name: 'framecore',
            children: [
                //更多操作(提成反结账),路由跳转打开新界面或弹框
                {path: '/noCheckOut_RY:form?', component: NoCheckOut_RY, name: 'noCheckOut_RY'},
                {path: '/noCheckOut_DN:form?', component: NoCheckOut_DN, name: 'noCheckOut_DN'},
            ],
        },
        {
            path: '/treeformview:form?',
            component:resolve => require(['../views/form/frame/TreeFormView.vue'], resolve) ,
            name: 'treeformview'
        },
        //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].[chunkhash:8].js"
        },
        
        plugins: [
            new webpack.ProvidePlugin({
                $: 'jquery'
            }),
            new ExtractTextPlugin("css/styles.css"),
            new HtmlWebpackPlugin({
              
                template: "index.html",
                favicon: resolveApp('favicon.ico'),
                inject: true,
                hash: true
            }),
            new webpack.optimize.CommonsChunkPlugin("common.js"),

        ],
阅读 2.2k
1 个回答

异步组件的引用方式应该是这样的
const FrameList= () => import(/ webpackChunkName: "framelist" /'../views/framelist/Framelist.vue').then(m => m.default);

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