linaria: EvalError: Unexpected token 'export' in
Environment
- Linaria version: 4.1.0
- Bundler (+ version): webpack 5.78
- Node.js version: 16
- OS: ubuntu
Description
➤ YN0000: /home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:384
➤ YN0000: throw new EvalError(`${e.message} in${callstack.join('\n| ')}\n`);
➤ YN0000: ^
➤ YN0000:
➤ YN0000: EvalError: Unexpected token 'export' in
➤ YN0000: | /home/circleci/project/node_modules/antd/es/index.js
➤ YN0000: | src/app/App.tsx
➤ YN0000:
➤ YN0000: at /home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:384:15
➤ YN0000: at Array.forEach (<anonymous>)
➤ YN0000: at Module.evaluate (/home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:361:10)
➤ YN0000: at require.Object.assign.ensure (/home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:319:11)
➤ YN0000: at src/app/App.tsx:1:46
➤ YN0000: at src/app/App.tsx:2:3
➤ YN0000: at Script.runInContext (node:vm:139:12)
➤ YN0000: at /home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:368:16
➤ YN0000: at Array.forEach (<anonymous>)
➤ YN0000: at Module.evaluate (/home/circleci/project/node_modules/@linaria/babel-preset/lib/module.js:361:10)
Seems related to babel doing a transform it shouldn’t?
Reproducible Demo
https://github.com/ntucker/anansi/pull/1591
- git clone https://github.com/ntucker/anansi
- git checkout renovate/major-linaria
- yarn install
- yarn build:pkg
- cd examples/concurrent
- yarn build
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fix(babel): imported value is undefined/not a function (fixes #1022) — committed to callstack/linaria by Anber 2 years ago
- fix(babel): circuit breaker for cyclic dependencies (fixes #1022) — committed to callstack/linaria by Anber 2 years ago
- fix(babel): better detector for transpiled JSX (fixes #1022) — committed to callstack/linaria by Anber 2 years ago
- fix(babel): change default rules to process ES-modules (fixes #1022) — committed to callstack/linaria by Anber 2 years ago
It supports if it is an
mjsfile with fully specified imports. But if you checknode_modules/antd/es/index.jsin your project, you will see that the file itself is notmjs, and all imports inside don’t have extensions.