linaria
linaria copied to clipboard
Error when parsing Mobx
Environment
npm ls
├── @babel/[email protected]
├── @linaria/[email protected]
├── @linaria/[email protected]
├── @linaria/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]
node -v
v16.13.1
On macOS Monterey
Description
When I tried to update to the latest Linaria version, I ran into a strange parsing bug. Originally it failed on dist/mobx.esm.js from the popular MobX library.
I've boiled down the code to the following example:
// main.js
import { css } from "@linaria/core";
import { b } from "./mobx.js";
css``;
// mobx.js
var _;
var a = void _;
function b(b) {
void _;
}
export { a, b };
When trying to parse this, it will fail with:
ERROR in ./src/main.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/jhnns/dev/jhnns/linaria-bug-repo/src/main.js: /Users/jhnns/dev/jhnns/linaria-bug-repo/src/mobx.js: Exporting local "b", which is not declared.
7 | }
8 |
> 9 | export { a, b };
| ^
Could be a Babel bug, but since it only happens in conjunction with Linaria I guess this is the right place to start 😁
Reproducible Demo
The example is pretty small and simple:
https://github.com/jhnns/linaria-bug-repo