1.[Vue warn]: Failed to mount component: template or render function not defined.
2.Getting error configuration.resolve.extensions[0] should not be empty

两个报错连环
运行vue项目时候在出现报错:内容是
[Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <Anonymous>
       <Root>
解决办法是:需要在webpack.config.js文件中添加以下配置:
resolve: {
        /**
         * Vue v2.x之后NPM Package默认设置只会生成runtime-only 版本,若要使用standalone功能則需如下设置
         * 否则会报错:Failed to mount component: template or render function not defined.
         */
        alias: {
            vue: 'vue/dist/vue.js'
        },
        extensions: ['', '.js', '.vue']
}
放在和module平齐的代码中,例如:
module: {
    },
    babel: {
       
    },
    resolve: {
    }

但是项目又出现新的报错:Getting error configuration.resolve.extensions[0] should not be empty

 

Logo

前往低代码交流专区

更多推荐