From 6364b9eb860c944a18b88d4dd563180268e58dd8 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Sun, 7 Mar 2021 16:25:15 +0100 Subject: [PATCH] Small fixes to packages.json for react-native compat 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 https://github.com/eemeli/make-plural/issues/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. --- packages/core/package.json | 7 +++++-- packages/detect-locale/package.json | 7 +++++-- packages/macro/package.json | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 557429b42..6ee067079 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -29,8 +29,11 @@ "node": ">=10.0.0" }, "exports": { - "require": "./index.js", - "import": "./esm/index.js" + ".": { + "require": "./index.js", + "import": "./esm/index.js" + }, + "./package.json": "./package.json" }, "files": [ "LICENSE", diff --git a/packages/detect-locale/package.json b/packages/detect-locale/package.json index e3dcac5d0..aeb883f39 100644 --- a/packages/detect-locale/package.json +++ b/packages/detect-locale/package.json @@ -29,8 +29,11 @@ "node": ">=10.0.0" }, "exports": { - "require": "./index.js", - "import": "./esm/index.js" + ".": { + "require": "./index.js", + "import": "./esm/index.js" + }, + "./package.json": "./package.json" }, "files": [ "LICENSE", diff --git a/packages/macro/package.json b/packages/macro/package.json index 534d4c922..ac602540f 100644 --- a/packages/macro/package.json +++ b/packages/macro/package.json @@ -2,7 +2,7 @@ "name": "@lingui/macro", "version": "3.7.0", "description": "Macro for generating messages in ICU MessageFormat syntax", - "main": "index.ts", + "main": "index.js", "author": { "name": "Tomáš Ehrlich", "email": "tomas.ehrlich@gmail.com"