Skip to content

Commit 939f4ad

Browse files
committed
fix: dts generation path, close #127
1 parent 7fed56a commit 939f4ad

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
.DS_Store
33
dist
44
.idea
5+
components.d.ts

examples/vite-vue2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"cross-env": "^7.0.3",
13-
"unplugin-vue-components": "file:../..",
13+
"unplugin-vue-components": "workspace:*",
1414
"vite": "^2.4.4",
1515
"vite-plugin-vue2": "^1.8.1"
1616
}

examples/vite-vue2/vite.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { UserConfig } from 'vite'
22
import { createVuePlugin } from 'vite-plugin-vue2'
3-
import ViteComponents from 'unplugin-vue-components/vite'
3+
import Components from 'unplugin-vue-components/vite'
44

55
const config: UserConfig = {
66
plugins: [
77
createVuePlugin(),
8-
ViteComponents(),
8+
Components({
9+
dts: 'src/components.d.ts',
10+
}),
911
],
1012
build: {
1113
sourcemap: true,

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/declaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export async function generateDeclaration(ctx: Context, root: string, filepath:
1818
return undefined
1919

2020
const related = slash(path).startsWith('/')
21-
? `./${relative(dirname(filepath), resolve(root, path.slice(1)))}`
21+
? `./${relative(dirname(filepath), path)}`
2222
: path
2323

2424
let entry = `typeof import('${slash(related)}')`

0 commit comments

Comments
 (0)