Hi,
I tried to use lingui with CRA but I'm getting an error when I run lingui extract
`
Extracting messages from source files…
/Users/hami/Work/Hami/tour/build/service-worker.js
/Users/hami/Work/Hami/tour/build/static/js/main.df94a9fa.js
/Users/hami/.config/yarn/global/node_modules/babel-core/lib/transformation/file/index.js:590
throw err;
^
SyntaxError: /Users/hami/Work/Hami/tour/src/App.js: Unexpected token (11:11)
9 |
10 |
11 | return
| ^
12 |
13 |
14 |
at Parser.pp$5.raise (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$3.parseExprAtom (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3750:12)
at Parser.pp$3.parseExprSubscripts (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3494:19)
at Parser.pp$3.parseMaybeUnary (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3474:19)
at Parser.pp$3.parseExprOps (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3404:19)
at Parser.pp$3.parseMaybeConditional (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3381:19)
at Parser.pp$3.parseMaybeAssign (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3344:19)
at Parser.pp$3.parseExpression (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:3306:19)
at Parser.pp$1.parseReturnStatement (/Users/hami/.config/yarn/global/node_modules/babylon/lib/index.js:2078:26)
`
I don't want to eject my CRA, is it possible to use lingui?
I also found this and it works without babel preset:
https://github.com/lingui/tutorial-lingui-react/tree/master/without_babel_preset
But I can not use it with CRA.
Try to create .babelrc with react-app preset:
{
"presets": ["react-app"]
}
I'm just migrating old docs, so this should be available in new docs soon.
That works. Thanks.
@tricoder42 have you added Create React App integration docs? I can't seem to find them.
@superandrew213 No, it's still missing in new docs. I'm just releasing first version of CLI which supports CRA and next week I'm planning to release jsLingui 3.0 which replaces plugins with macros and will work with CRA 2.0 (once it's released).
After that, I'll write integration docs, but at the time it's gonna be super easy. Basically, no configuration at all and no ejecting...
Most helpful comment
@superandrew213 No, it's still missing in new docs. I'm just releasing first version of CLI which supports CRA and next week I'm planning to release jsLingui 3.0 which replaces plugins with macros and will work with CRA 2.0 (once it's released).
After that, I'll write integration docs, but at the time it's gonna be super easy. Basically, no configuration at all and no ejecting...