-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metro Bundler ignores make-plural #15
Comments
Interesting. I think this is the actual source: react-native-community/cli#1168. While there's no harm in including |
Hm good find! I'm not sure if based on that issue the |
@Jonesus is this really a problem in your case? When investigating the same issue in uuidjs/uuid#444 I experienced that |
Corresponding upstream Node.js issue: nodejs/node#33460 |
@ctavan yeah it is, at least when I follow the reproduction steps I posted above I get error 500 from the metro bundler telling me that |
Running the repro steps, I'm able to see the warning print in the console, but no error. Does that happen after some other operations? It's possible that there are two issues being conflated here. |
Ah, missed the
|
Hmm I wonder where that came from, yesteday everything seemed to work 🤔 |
For iOS you may need to:
|
Here's what I did: git clone https://github.com/Jonesus/make-plural-repro
cd make-plural-repro
npm i
cd ios && pod install && cd ..
npm run ios
# Received: Error: Cannot find module '@react-native-community/cli/build/commands/bundle/filterPlatformAssetScales'
npm i --save-dev @react-native-community/cli
npm start
# and in a second terminal:
npm run ios This results in the following error:
|
I'm still getting some issues getting to the right error, but it's getting a bit ridiculous setting up a whole toolchain and emulator in order to locally fail the right way. @Jonesus Could you hack your local |
I believe this is a deeper problem with the metro bundler resolution algorithm. When I hack If I replace --- a/App.js
+++ b/App.js
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
-import { en } from 'make-plural/plurals';
+import { en } from 'make-plural'; I get a different error:
So there is a problem with module resolution, but it I'm not 100% sure if it's even caused by react-native-community/cli#1168 |
Yeah, I think this is at least related to this issue: facebook/metro#535 The bundler is probably using the package.json I'll be very happy when I can start dropping CommonJS support from my libraries, because the variety of these corner cases is ridiculous. |
This should now be fixed in |
This is still happening for me with 6.2.2:
If I try with
|
|
Thank you that's worked for me. I had to add the default extensions too.
|
For me, it was adding
in the |
React Native's Metro bundler expects all imports to be declared in the `exports` attribute when there is one defined. Lingui imports it (to get the version I guess?) and Metro refuses it as it was not defined as a valid export. See eemeli/make-plural#15 for a similar issue on the `make-plural` package The `main` field for `@babel/macro` was also incorrect as there is no `index.ts` in this project.
Metro Bundler (used in e.g. React Native development) ignores
make-plural
with the following error message:warn Package make-plural has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in <project-dir>/node_modules/make-plural/package.json
Similar issue had recently been resolved at facebook/react-native#28710 with the fix i18next/i18next-http-backend@1d8da79#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R8
How to reproduce (example based on create-react-native-app):
git clone https://github.com/Jonesus/make-plural-repro
npm install
npm run start
We can confirm that it doesn't get bundled by trying to run the example
App.js
withnpm run android
ornpm run ios
The text was updated successfully, but these errors were encountered: