sindresorhus / normalize-url

Normalize a URL
MIT License
837 stars 123 forks source link

Add `package.json` to `exports` #157

Closed redexp closed 2 years ago

redexp commented 2 years ago

I'm using this module in react-native project and without next modification to package.json file it throws warning

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

Modification needed

{
  "exports": {
    ".": "./index.js",
    "./package.json": "./package.json"
  }
}

I think it's because of Introducing the "exports" field prevents consumers of a package from using any entry points that are not defined docs and webpack needs access to package.json

sindresorhus commented 2 years ago

This is a problem with React Native. You should report it on the React Native issue tracker instead. It's a losing battle to get every single package out there to manually expose package.json just for React Native.

redexp commented 2 years ago

@sindresorhus I have a lot installed packages and I was surprised when such small package like yours was first which throws any warnings. Changing "exports": "./index.js" to "main": "index.js" also works.