linaria
linaria copied to clipboard
Between ^3.0.0-beta.22 and 4.0.0-beta.0 vite with linaria broke
Environment
I've included the environments for both cases in the following code sandboxes. The sandboxes are completely identical other than the linaria versions in package.json.
Description
When I try to use the linaria rollup plugin in 4.1.2 I get an error Cannot use 'import.meta' outside a module'.

Reproducible Demo
I've included two demos. The first one shows the failure case, the second one shows the success case. The issue first appears in version 4.0.0-beta.0.
This is hitting me as well. Was using the the v3 Beta in an Astro site and I'm currently unable to upgrade.
Same issue for me.
Yeah Linaria v4 doesn't work with Rollup, but v3 does.
Is there any solution?
added the repo to reproduce this error https://github.com/Dmitra/linaria-vite When you first launch the project there is an error:
[vite] Internal server error: The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00react/jsx-dev-runtime'
Plugin: linaria
File: /home/dmitra/dev/1/linaria-vite/index.jsx
at Object.openSync (node:fs:586:10)
at readFileSync (node:fs:462:35)
at /home/dmitra/dev/1/linaria-vite/node_modules/@linaria/babel-preset/lib/transform-stages/1-prepare-for-eval.js:251:48
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async prepareForEval (/home/dmitra/dev/1/linaria-vite/node_modules/@linaria/babel-preset/lib/transform-stages/1-prepare-for-eval.js:226:24)
at async Promise.all (index 1)
at async prepareForEval (/home/dmitra/dev/1/linaria-vite/node_modules/@linaria/babel-preset/lib/transform-stages/1-prepare-for-eval.js:263:3)
at async transform (/home/dmitra/dev/1/linaria-vite/node_modules/@linaria/babel-preset/lib/transform.js:141:31)
at async TransformContext.transform (/home/dmitra/dev/1/linaria-vite/node_modules/@linaria/rollup/lib/index.js:75:22)
at async Object.transform (file:///home/dmitra/dev/1/linaria-vite/node_modules/vite/dist/node/chunks/dep-665b0112.js:41031:30)
After change in the repo after first reload the error is the same as in this issue description
@lukesmurray why there is a tag "needs repro" - the issue is easily reproducible
@Dmitra No idea, I didn't add the tag manually. It was probably automatically added using linaria's issue template. For context I also included two reproductions with my initial report.
linaria not working with 4.1.2 linaria working with 3.0.0-beta.22