Closed StupidIncarnate closed 3 years ago
Looks like the fix ended up being that I needed 'babel-plugin-macros' declared in the root babel.config.js as well.
Super!! that you found the issue that easy.
If you're interested in contributing to Lingui we're looking for people that used lingui v3 within a monorepo for improve the documentation about that.
Describe the bug We have a monorepo where our ui projects ref a common ui package. I can:
@lingui/macro
in the actual ui projects and start the project no problem@lingui/macro
in the common ui project and run extract/compile from the actual ui project to get it to build the po files in both locations.However when I use t/Trans from
@lingui/macro
in a@common/ui
component, reference it in project1, and go to start project1 (nextjs) or build it, I'm getting an error from the common ui project:Error: Can't resolve 'module' in projects/repo/common/ui/node_modules/import-fresh/node_modules/resolve-from
If I webpack alias
@lingui/macro
inside the ui project, the error changes to:Error: Can't resolve 'module' in project/repo/project1/node_modules/import-fresh/node_modules/resolve-from
If I only have lingui in project1, it works as expected.
So something breaks when lingui is uses in a common folder and ref'd in the project. It seems like its something to do with config loading but I'm not sure. Any help would be appreciative.
To Reproduce Steps to reproduce the behavior, possibly with minimal code sample, e.g:
import {component} from '@common/ui'
import {t} from '@lingui/macro'
in the common/ui projectExpected behavior I'd like to be able to use lingui in a common pkg that other apps can use and that lingui will know how to pull translations from both the project and the common ui.
Additional context We have a monorepo setup that looks like this:
project1 lingui.config.js
@common/ui
lingui.config.jsroot lingui.config.js
.babelrc
) or framework you use (Create React App, Meteor, etc.) We use next.js for our ui apps.project1/.babelrc
root babel.config.js
next.config.js