luxon icon indicating copy to clipboard operation
luxon copied to clipboard

[package.json] Add ./package.json to exports

Open hatem-72 opened this issue 2 years ago • 3 comments

This PR fixes the compatibility between react-native and the last luxon versions (broken since v2.5.0).

It adds the package.json to the exports section

  "exports": {
    ".": {
      "import": "./src/luxon.js",
      "require": "./build/node/luxon.js"
    },
+   "./package.json": "./package.json",
  },

It is something you can find in other popular libraries that have to deal with multiple js environments and bundlers, such as react-native. Something similar happened to the uuidjs/uuid repository:

This PR will close https://github.com/moment/luxon/issues/1238

hatem-72 avatar Jul 11 '22 11:07 hatem-72

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: hatem-72 (1bda23485131582703e56c2d034b7535f738b406)

Hi @icambron can this be merged?

gbinu42 avatar Jul 20 '22 11:07 gbinu42

Just merged the same fix here: https://github.com/nhost/nhost/pull/828.

dminkovsky avatar Jul 30 '22 18:07 dminkovsky

I believe the bug is still here in version 3.0.1.

cglacet avatar Aug 25 '22 15:08 cglacet

I don't understand what this does, but I don't see an issue with exporting package.json

icambron avatar Aug 29 '22 20:08 icambron

@icambron if you don't modify the file as suggested here it gives the following error :

warn Package luxon has been ignored because it contains invalid configuration. 
Reason: Package subpath './package.json' is not defined by "exports" in /Users/project/node_modules/luxon/package.json

cglacet avatar Sep 23 '22 09:09 cglacet