EvalError: Unexpected token 'export' in
See original GitHub issueEnvironment
- 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
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:18
Top Results From Across the Web
Getting Unexpected Token Export - javascript
I am trying to run some ES6 code in my project but I am getting an unexpected token export error.
Read more >How to fix SyntaxError: Unexpected token 'export' in ...
In this article, we are going to see How to fix SyntaxError: Unexpected token 'export' in JavaScript? and what are Es6 modules.
Read more >SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >SyntaxError: Unexpected token - JavaScript
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >SyntaxError: Unexpected token 'export' - Abhishek Kumar
In case you are getting error like 'Unexpected token export' while starting the server, then export like below in schema.js
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.In that specific case antd is used, because
styledhave to know the type of component it wraps and that’s why Linaria tries to evaluate it. However, inners of antd can be treeshaked a bit more effectively.