-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue: Pass vite aliases imports to vue-docgen-api
#22153
Vue: Pass vite aliases imports to vue-docgen-api
#22153
Conversation
b0d997b
to
f88590f
Compare
f88590f
to
064f527
Compare
i will review this for now, However i'm finishing a PR that implements volar ( vue-meta-component ) instead of vue-docgen-api, i guess we won't have this issue let see . |
Related: #22010 |
vue-docgen-api
@kasperpeulen is this PR no longer needed because of Volar? |
@chakAs3 @larsrickert Can you check if this is still necessary? |
No I'd say this is not needed. As far as I know both For the reproduction code, you need to create a {
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["src/**/*"],
"compilerOptions": {
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
} For |
@larsrickert I see, closing this PR then. |
Closes #21691
What I did
When we use an import alias to a component that
vue-docgen-api
will need to parse to be able to generate the metadata it will not understand how to deal with this importThe import aliases config is declared at the vite, so we need to pass it to
vue-docgen-api
too, but if we pass it directly we will have a problemIn
vite
we can define an absolute path that the reference is actually where thevite
server is running, example:If the project is running at the path
/home/projects/vue-storybook
vite
will consider the absolute path/src
relate to the server, butvue-docgen-api
needs the system absolute path to find the file, in this case the actually path is:/home/projects/vue-storybook/src
. So, before passing the aliases tovue-docgen-api
we need to deal with this kind of absolute paths, we need transform it to actually system paths.How to test
It's possible to reproduce the error here:
Or if you want to use the repo:
yarn task --task dev --template vue3-vite-default-js
vite.config
the alias:"@": '/src'
src/mixins
Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]