Comments (7)
You need babel-plugin-macros to be installed and added to babel config. You do use macro. Any import from @lingui/macro
is a macro (virtual methods which get transpiled to something else during build)
from js-lingui.
@thekip thanks for your quick help!
I installed the plugin and added it to the .babelrc, now I am getting this error
ERROR in ./app/main.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/steph/Workspace/myapp-studio/app/main.js: Cannot find module '@lingui/macro' from '/Users/steph/Workspace/myapp-studio/app'
at Function.resolveSync [as sync] (/Users/steph/Workspace/myapp-studio/node_modules/resolve/lib/sync.js:111:15)
at nodeResolvePath (/Users/steph/Workspace/myapp-studio/node_modules/babel-plugin-macros/dist/index.js:62:18)
at applyMacros (/Users/steph/Workspace/myapp-studio/node_modules/babel-plugin-macros/dist/index.js:203:23)
at ImportDeclaration (/Users/steph/Workspace/myapp-studio/node_modules/babel-plugin-macros/dist/index.js:110:28)
at NodePath._call (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:46:20)
at NodePath.call (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:36:17)
at NodePath.visit (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:82:31)
at TraversalContext.visitQueue (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:86:16)
at TraversalContext.visitMultiple (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:61:17)
at TraversalContext.visit (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:107:19)
at traverseNode (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
at traverse (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/index.js:52:34)
at NodePath.traverse (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/index.js:101:24)
at PluginPass.Program (/Users/steph/Workspace/myapp-studio/node_modules/babel-plugin-macros/dist/index.js:91:18)
at newFn (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/visitors.js:160:14)
at NodePath._call (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:46:20)
at NodePath.call (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:36:17)
at NodePath.visit (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/path/context.js:82:31)
at TraversalContext.visitQueue (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:86:16)
at TraversalContext.visitSingle (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:65:19)
at TraversalContext.visit (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/context.js:109:19)
at traverseNode (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
at traverse (/Users/steph/Workspace/myapp-studio/node_modules/@babel/traverse/lib/index.js:52:34)
at transformFile (/Users/steph/Workspace/myapp-studio/node_modules/@babel/core/lib/transformation/index.js:82:31)
at transformFile.next (<anonymous>)
at run (/Users/steph/Workspace/myapp-studio/node_modules/@babel/core/lib/transformation/index.js:24:12)
at run.next (<anonymous>)
at transform (/Users/steph/Workspace/myapp-studio/node_modules/@babel/core/lib/transform.js:22:33)
at transform.next (<anonymous>)
at step (/Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:261:32)
at /Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:273:13
at async.call.result.err.err (/Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:223:11)
at /Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:189:28
at /Users/steph/Workspace/myapp-studio/node_modules/@babel/core/lib/gensync-utils/async.js:67:7
at /Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:113:33
at step (/Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:287:14)
at /Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:273:13
at async.call.result.err.err (/Users/steph/Workspace/myapp-studio/node_modules/gensync/index.js:223:11)
@ multi ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js?sockHost=localhost&sockPort=3000&sockProtocol=http ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js?sockHost=localhost&sockPort=3000&sockProtocol=http @babel/polyfill ./app/main.js main[5]
My .babelrc now:
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"env": {
"production": {
"plugins": [
"macros",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-optional-chaining"
]
},
"development": {
"plugins": [
"macros",
[ "@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-optional-chaining",
"react-refresh/babel",
[
"i18next-extract",
{
"locales": ["en", "de"],
"defaultNS": "common",
"keySeparator": null,
"nsSeparator": "::",
"defaultValue": null
}
]
]
},
"test": {
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-optional-chaining",
"i18next-extract",
[
"@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
}
}
}
from js-lingui.
Have you installed @lingui/macro?
from js-lingui.
Yes, sure. v4.7.1
from js-lingui.
Unfortunately, i couldn't help with the issue without a reproduction repo.
from js-lingui.
Could you maybe still reopen the issue? Someone else might be able to help...
from js-lingui.
@stoefln check your configuration. It's 100% problem in your setup, not in the Lingui. Go through one of examples and compare to your setup. No one will to debug your code instead of you.
from js-lingui.
Related Issues (20)
- Support backup messages HOT 7
- Extract removes manual comments from po files HOT 1
- React Fragment (`<>`) inside `<Plural>` is not working HOT 5
- Impossible to use with Vite? HOT 1
- definePlural macro HOT 4
- rspack now supports wasm plugins, lingui integration example could be improved HOT 3
- Escaped curly-braces doesn't preserve in development mode HOT 1
- <Trans> breaks React JSX semantics with regards to booleans HOT 3
- Consider renaming of the macro components HOT 3
- selectOrdinal error HOT 2
- Lingui CLI extraction puts msgid as msgstr HOT 3
- i18n._(id) throws error if id param passed as undefined
- # is being replaced by%__lingui_octothorpe__% outside plural and selectordinal HOT 3
- Setup with webpack
- Order by is not alphabetically HOT 1
- t`` macro doesn't work when load and activate message HOT 2
- Avoid flashing of the default language HOT 1
- Ids are displayed sometimes on production build HOT 3
- Getting an error when using with vite and swc HOT 2
- `lingui extract <..files>` overwrites obsolete flag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-lingui.