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

  1. git clone https://github.com/ntucker/anansi
  2. git checkout renovate/major-linaria
  3. yarn install
  4. yarn build:pkg
  5. cd examples/concurrent
  6. 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

Most upvoted comments

It supports if it is an mjs file with fully specified imports. But if you check node_modules/antd/es/index.js in your project, you will see that the file itself is not mjs, and all imports inside don’t have extensions.