Closed JasonLandbridge closed 3 years ago
@JasonLandbridge Yes, it is definitely a bug, a wrong kind of slashes is generated on Windows. It would be awesome, if you can create a PR with a fix, otherwise I will have a look at the issue hopefully this week.
Sure! I have been able to isolate the issue to function ensureRelative() as it is used here.
A "hack" would be to just stick .replace('\\', '/')
at the end of the function:
function ensureRelative(path: string) {
return (path.startsWith("./") || path.startsWith("../") ? path : "./" + path).replace('\\', '/');
}
But I'm unsure if that would be a fix or just make it worse for others who are using it.
Is there a way for me to check what kind of filesystem it is running on and apply the .replace('\\', '/')
based on that?
@JasonLandbridge I believe this is a good enough solution :) Could you please create a PR?
Sure, I have just created a pull request. I tested the function ensureRelative() in isolation and its working when I feed it the paths but I haven't been able to test in during the build generation. I hope you can give it a quick test :D
@JasonLandbridge Thanks for the contribution! I've published version 0.1.7 with your fix.
Great! I can confirm it is working now! Thanks for your help!
This is what you currently get in the generated
web-types.json
file:But if you fix the pathing manually to:
Then everything works, is this a bug or should this be changed through the configuration?
This is how I did it:
npm i vue-docgen-web-types
package.json
update-web-types
npm command../web-types.json
I also don't have JsDoc installed.