unplugin-vue-components
unplugin-vue-components copied to clipboard
When I used the custom SVG icon in the webpack 5 project, I found that the webpack did not parse the files correctly
Describe the bug
When I used plugin-auto-import in my webpack5 project, I found that the custom svg icon component failed to be packaged, with the following error:
When I moved the custom SVG icon component out of the component auto-registration directory, everything was fine.
Configuration for my webpack::
const autoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack');
module: {
rules: [
{
test: /\.svg$/,
include: [utils.resolve("components/SvgIcon/icon")],
use: [{
loader: 'svg-sprite-loader',
options: {
symbolId: '[name]'
}
}],
},
]
},
plugins: [
autoImport({
imports: [
'vue',
'vue-router',
],
eslintrc: {
enabled: true,
},
}), //自动导入第三方库
Components({
directives: false, // 默认为 true 表示为vue3 false 为vue2
}), //自动导入第三方组件或者自定义组件
]
Reproduction
no
System Info
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
Memory: 17.92 GB / 31.73 GB
Binaries:
Node: 14.21.3 - C:\Program Files\nodejs\node.EXE
npm: 6.14.18 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.2070.0), Chromium (115.0.1901.188)
Internet Explorer: 11.0.22621.1
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
hi, need reproduction