-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Vite + Linaria + exports
field in package.json
= crash
#11035
Comments
Looks similar to #11020 (comment) |
@sodatea if I use Rollup with a similar set up I do not get any errors. So I'm thinking it's an issue with Vite rather than Rollup. |
I should add that Vite crashes when running either |
Same bug with [email protected] |
@Anber would you know anything about this bug with Vite+linaria? |
@nstepien is it a Windows-specific bug? I tried https:/nstepien/vite-bug, and it works well. |
@Anber Mmh, I don't have another machine to confirm whether this is Windows-only 🤔 |
Same issue with |
I've looked into it more deeply, Linaria outputs code like this: import "D:/repos/vite-bug/main_lquf2n.css"; The path uses If I patch Vite's const prefix1 = 'D:/repos/vite-bug/';
const prefix2 = 'D:\\repos\\vite-bug\\';
id = id.replace(prefix1, prefix2); or const prefix1 = 'D:/repos/vite-bug/';
const prefix2 = './';
id = id.replace(prefix1, prefix2); then Vite + Linaria works as it should. @Anber |
Fixed in Linaria. |
Describe the bug
I tried setting up Playwright for component testing, which uses vite, in our existing components library repo, but I ended up hitting a roadblock with Vite using the
exports
field for linaria's local/relative imports.Vite should ignore the
exports
field in the localpackage.json
file.What is actually happening is this error:
If I remove the
exports
field then the error goes away, but I cannot remove it.Reproduction
https:/nstepien/vite-bug
Steps to reproduce
npm ci
npm run build
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: