Module parse failed: Unexpected token (3:27) File was processed with these loaders: * ./node_module
Module parse failed: Unexpected token (10:27)File was processed with these loaders:* ./node_modules/vue-loader-v16/dist/templateLoader.js* ./node_modules/cache-loader/dist/cjs.js* ./node_modules/vue-l
·
Module parse failed: Unexpected token (10:27)
File was processed with these loaders:
* ./node_modules/vue-loader-v16/dist/templateLoader.js
* ./node_modules/cache-loader/dist/cjs.js
* ./node_modules/vue-loader-v16/dist/index.js
You may need an additional loader to handle the result of these loaders.
vue2.*
该错误解决办法如下
vue.config.js
{
// ***********
configureWebpack: {
module: {
rules: [
{
test: /\.vue$/,
use: [
{
loader: 'vue-loader',
},
],
}
],
},
}
// **************
}
接下来可能报这个错误
Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined
看下vue版本和@vue/compiler-sfc版本,记得保持一致,还有一个vue-loader下载最新的
npm i @vue/compiler-sfc@latest
npm i vue-loader@next
vue3.*
如果你使用的是vue3.0
就不要添加vue-loader,因为vue3.0有自己的loader
造成这个的原因是添加了lang=‘ts’,你需要添加typescript和ts-loader,然后在webpack中添加
在这里插入代码片
{
test: /\.ts$/,
loader: 'ts-loader',
options: { appendTsSuffixTo: [/\.vue$/] }
}
vue3.*添加vue-loader
vue3.*拥有自己的loader,vue-loader处理带有setup的vue3组件会爆出下面错误
“Component is missing template or render function.”
你把import的组件输出出来会发现啥都没有
更多推荐
已为社区贡献9条内容
所有评论(0)