Skip to content

Commit 79b101f

Browse files
committed
feat: support importPathTransform config, close #9
1 parent 329156d commit 79b101f

File tree

10 files changed

+222
-47
lines changed

10 files changed

+222
-47
lines changed

example/basic/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"typescript": "^4.1.5",
1818
"vite": "^2.0.2",
1919
"vite-plugin-components": "workspace:*",
20-
"vite-plugin-md": "^0.5.1"
20+
"vite-plugin-md": "^0.5.1",
21+
"vite-plugin-vue-svg": "^0.1.0"
2122
}
2223
}

example/basic/src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<div class="block">
2929
<h1>Custom Resolvers (1)</h1>
3030
<MyCustom />
31+
<CarbonSvg />
3132
</div>
3233

3334
<div class="block">
Lines changed: 7 additions & 0 deletions
Loading

example/basic/vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { UserConfig } from 'vite'
33
import Vue from '@vitejs/plugin-vue'
44
import ViteComponents from 'vite-plugin-components'
55
import Markdown from 'vite-plugin-md'
6+
import SVG from 'vite-plugin-vue-svg'
67

78
const config: UserConfig = {
89
alias: {
@@ -13,10 +14,12 @@ const config: UserConfig = {
1314
include: [/\.vue$/, /\.md$/],
1415
}),
1516
Markdown(),
17+
SVG(),
1618
ViteComponents({
17-
extensions: ['vue', 'md'],
19+
extensions: ['vue', 'md', 'svg'],
1820
directoryAsNamespace: true,
1921
globalNamespaces: ['global'],
22+
importPathTransform: path => path.endsWith('.svg') ? `${path}?component` : undefined,
2023
customLoaderMatcher: path => path.endsWith('.md'),
2124
customComponentResolvers: [
2225
(name) => {

0 commit comments

Comments
 (0)