unknown Expression of type "TemplateLiteral"
See original GitHub issueDescribe the bug
CLI related: When running lingui extract
I’m getting the following error:
~/code/react-testing-library-course (wip/lingui)
😎 $ lingui extract
/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:946
throw new Error("unknown Expression of type " + JSON.stringify(expr.type));
^
Error: unknown Expression of type "TemplateLiteral"
at Emitter.Ep.explodeExpression (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:946:13)
at explodeViaTempVar (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:742:23)
at /Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:827:54
at Array.map (<anonymous>)
at Emitter.Ep.explodeExpression (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:825:63)
at explodeViaTempVar (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:742:23)
at /Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:827:54
at Array.map (<anonymous>)
at Emitter.Ep.explodeExpression (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:825:63)
at Emitter.Ep.explodeStatement (/Users/kdodds/code/react-testing-library-course/node_modules/regenerator-transform/lib/emit.js:524:21)
To Reproduce
I’m honestly not certain. I can’t seem to do anything to get this to not happen.
Here’s the repo/branch: https://github.com/kentcdodds/react-testing-library-course/tree/wip/lingui
Expected behavior
I expect the messages to be extracted with a proper message as indicated in the getting started guide.
Additional context
I’m trying to create a course for react-testing-library and want to include how to test with localized content loaded.
- jsLingui version
lingui --version
: 2.6.0 - Babel version
npm list babel-core
~/code/react-testing-library-course (wip/lingui)
😎 $ npm list babel-core
react-testing-library-course@1.0.0 /Users/kdodds/code/react-testing-library-course
├── babel-core@7.0.0-bridge.0
├─┬ jest@23.5.0
│ └─┬ jest-cli@23.5.0
│ ├─┬ jest-config@23.5.0
│ │ └─┬ babel-core@6.26.3
│ │ └─┬ babel-register@6.26.0
│ │ └── babel-core@6.26.3
│ └─┬ jest-runtime@23.5.0
│ └── babel-core@6.26.3
└─┬ kcd-scripts@0.43.0
└── babel-core@7.0.0-bridge.0 deduped
- Your Babel config (e.g.
.babelrc
) or framework you use (Create React App, Meteor, etc.)
That’s actually a little tricky. I’m using configuration built-into kcd-scripts which you can see here is a little dynamic: https://github.com/kentcdodds/kcd-scripts/blob/master/src/config/babelrc.js
I use that as a preset and add @lingui/babel-preset-react
. I suppose this could be unrelated to js-lingui, but the build and tests work fine.
Interestingly, I noticed that lingui tries to process files in my coverage
directory and there doesn’t appear to be a way to tell lingui which files it should be processing… I deleted the coverage
directory and tried again and had the same result so I’m confident that’s not it, but it would probably be good to not attempt to process that all the same.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Update. Using node@8 for babel-preset-env works great 👍 Thanks!
I’ll probably just bump the minimal node version to 8 or something. Thanks!