linaria: Cannot 'resolveSync' because the fileSystem is not sync
Environment
@linaria/webpack5-loader/node_modules/enhanced-resolve/lib/Resolver.js:242
throw new Error(
^
Error: Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!
- Linaria version: “3.0.0-beta.13”,
- Bundler (+ version): next": “11.0.1” (with webpack 5)
- Node.js version: v14.16.1
- OS: OS-X
Description
Can’t get linaria up and running as the @linaria/webpack-loader throws an error:
Error: /my-project/src/foo.tsx: An unexpected runtime error occurred during dependencies evaluation:
/my-project/node_modules/@linaria/webpack5-loader/node_modules/enhanced-resolve/lib/Resolver.js:242
throw new Error(
^
Error: Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!
It may happen when your code or third party module is invalid or uses identifiers not available in Node environment, eg. window.
Note that line numbers in above stack trace will most likely not match, because Linaria needed to transform your code a bit.
Reproducible Demo
Here is a reproduction of the bug: bug.zip
related issues:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 18
Ok, let’s close this issue for now. Maybe I’ll find time for supporting SWC.
I have a first (very very limited) POC up and running 🎉 Right now it is blocked by a bug in css-loader: https://github.com/webpack-contrib/css-loader/issues/1381
If you like we can have a short call next week to take a look 😃
Next v11.1.3-canary.66 ships with a fix https://github.com/vercel/next.js/releases/tag/v11.1.3-canary.66 (it’s only a stop gap solution and might not work in all cases)
It’s rather a POC than a working PR… but right now I set it on hold because Vercel is moving away from Babel…
This means using Linaria for NextJs will slow down the build by upto 10 times 😕