js-lingui icon indicating copy to clipboard operation
js-lingui copied to clipboard

Unable to resolve "@lingui/babel-plugin-lingui-macro/macro" from "node_modules/@lingui/core/macro/index.js"

Open capaj opened this issue 7 months ago • 7 comments

Description

I have trouble running lingui on a fresh expo project. I have

    "expo": "~53.0.9",
    "@lingui/babel-plugin-lingui-macro": "^5.3.1",

and when I try to bundle my app, it throws:

Android Bundling failed 3158ms node_modules/expo-router/entry.js (3473 modules)
Unable to resolve "@lingui/babel-plugin-lingui-macro/macro" from "node_modules/@lingui/core/macro/index.js"

I also bumped into:

Android Bundling failed 1945ms node_modules/expo-router/entry.js (3566 modules)
The package at "node_modules/@lingui/conf/dist/index.cjs" attempted to import the Node standard library module "path".

but that one I was able to resolve by adding

config.resolver.unstable_enablePackageExports = false

to my metro.config.js

Verifications

  • [x] I've checked the docs and this isn't covered there.
  • [x] I've searched existing issues on GitHub.

Reproduction Steps

try to run an fresh expo project with lingui

Expected Behavior

it bundles

Macro Support

Babel with babel-macro-plugin

Lingui Version

5.3.1

Babel Version

7.27.1

Framework

Expo

capaj avatar May 11 '25 06:05 capaj

I could not help here without a reproduction repo. It seems like some mess with how bundler / running instance of node (or whatever is used in your setup) is resolving packages

timofei-iatsenko avatar May 12 '25 07:05 timofei-iatsenko

Will create a repro today.

capaj avatar May 12 '25 07:05 capaj

ah it works ok in a fresh repo. I was trying with my components/pages from a legacy react-native app https://github.com/authier-pm/authier/tree/expo-mobile-app/mobile-app

closing, works gr8 with fresh expo, sorry for false alarm

capaj avatar May 12 '25 07:05 capaj

I'm getting the same error on a new project.

node: v20.18.1 react: v19.0.0 expo: v53.0.9

ahmetkuslular avatar May 17 '25 16:05 ahmetkuslular

reopen this issue please

mancioshell avatar May 23 '25 22:05 mancioshell

Hi, i have the following error with a fresh expo installation.

Android Bundling failed 578ms node_modules\expo-router\entry.js (1293 modules)
The package at "node_modules\babel-plugin-macros\dist\index.js" attempted to import the Node standard library module "path".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries

This is my reproduction repo.

This is my local configuration:

node: v22.15.0
expo: "~53.0.9"
react": "19.0.0",
react-dom: "19.0.0",
react-native: "0.79.2"

Step to reproduce the issue:

  • yarn install
  • yarn start
  • open the app with expo go (scan qr code from the cli)

mancioshell avatar May 24 '25 14:05 mancioshell

@vonovak could you take a look at this issue? It's related to RN

timofei-iatsenko avatar May 26 '25 15:05 timofei-iatsenko

@mancioshell I installed your repro but wasn't able to reproduce the issue. Please double-check the repro and open a new issue if the problem persists. Try clearing the metro cache when you run yarn start

Thank you

vonovak avatar Jul 08 '25 20:07 vonovak