blog
blog copied to clipboard
Module parse failed: Unexpected token
技术
- webpack 5
- vue 3.1.1
- typescript 4.2
问题

ERROR in ./components/upload-name/src/UploadName.vue?vue&type=template&id=aa469cec 2:2
Module parse failed: Unexpected token (2:2)
File was processed with these loaders:
* ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
|
> <div :class="`${prefixClsNew}-wrapper`">
| <div :class="prefixClsNew">
| <a-upload
解决
在 webpack 配置中检查是否引入并使用 require('vue-loader').VueLoaderPlugin;
const vueLoaderPlugin = require('vue-loader').VueLoaderPlugin;
const weboackConfig = {
plugins: [
// ... other config
new vueLoaderPlugin(),
]
}