Skip to content

Commit

Permalink
fix: dts generation path, close #127
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 1, 2021
1 parent 7fed56a commit 939f4ad
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
.DS_Store
dist
.idea
components.d.ts
2 changes: 1 addition & 1 deletion examples/vite-vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"unplugin-vue-components": "file:../..",
"unplugin-vue-components": "workspace:*",
"vite": "^2.4.4",
"vite-plugin-vue2": "^1.8.1"
}
Expand Down
6 changes: 4 additions & 2 deletions examples/vite-vue2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { UserConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'
import ViteComponents from 'unplugin-vue-components/vite'
import Components from 'unplugin-vue-components/vite'

const config: UserConfig = {
plugins: [
createVuePlugin(),
ViteComponents(),
Components({
dts: 'src/components.d.ts',
}),
],
build: {
sourcemap: true,
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function generateDeclaration(ctx: Context, root: string, filepath:
return undefined

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

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

0 comments on commit 939f4ad

Please sign in to comment.