vite-plugin-solid icon indicating copy to clipboard operation
vite-plugin-solid copied to clipboard

Plugin does not support relative root setting of Vite

Open igorkamyshev opened this issue 3 years ago • 4 comments

Due to passing root as is to createRequire this plugin does not support relative root, it throws error in this case:

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'packages/solid/package.json'

Would it be better to add some check for it and resolve relative paths?

igorkamyshev avatar Oct 04 '22 17:10 igorkamyshev

When moving from:

image

And running `vite' i.e. yarn start I get:

image

I believe this is a similar issue.

codylindley avatar Oct 04 '22 22:10 codylindley

It would seem simply removing the root: './', in the vite.congfig.js fixes the issue. Guessing this jives cause my config is in the same directory as my index.html file.

e.g. https://stackblitz.com/edit/solidjs-templates-fkxu6h?file=vite.config.js,package.json

codylindley avatar Oct 05 '22 18:10 codylindley

It would seem simply removing the root: './', in the vite.congfig.js fixes the issue. Guessing this jives cause my config is in the same directory as my index.html file.

But it's impossible to use this approach in monorepo with more than one package 🥲

igorkamyshev avatar Oct 06 '22 16:10 igorkamyshev

I guess it depends upon the details, I am using this in a yarn workspace monorepo.

codylindley avatar Oct 06 '22 17:10 codylindley