Closed slavarazum closed 2 weeks ago
Please share a repo or a stackblitz demo (https://vitepress.new) where we can verify this. Most likely the paths are not resolving properly in first case. Have you tried using '@blog': fileURLToPath(...)
? IIRC by default the paths are relative to project root rather than the config file. You can also try '@blog': '.vitepress/theme'
Sure. I created demo project where I import ExampleComponent
with @components
alias in Layout. I have commented out all the options for registering an alias using object notation that you can try. I expected one of them to work.
Sorry, it should be '@components': '/.vitepress/theme/components',
(notice leading slash) -- https://stackblitz.com/edit/vite-9upneb?file=docs%2F.vitepress%2Fconfig.ts
Based on usage it seems that's how one is supposed to use them - https://github.com/search?q=vite%20alias%20/%5B'%22%5D%5B@~%5D.*?%5B'%22%5D:%20%5B'%22%5D%5C//&type=code
Might be better to create docs PR to rollup make it more clear.
Describe the bug
I'm trying to connect Laravel's structure with Vitepress subfolder via Vite aliases. It works properly when using
fileURLToPath(new URL('./path', import.meta.url))
to wrap the path, but it doesn't work with the simplified object notation.Reproduction
Vitepress config file:
Expected behavior
As described in ViteJS docs:
If I haven't missed something, the configuration should work as follows:
System Info
Additional context
No response
Validations