Skip to content
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

Add package.json to exports #30

Closed
wants to merge 1 commit into from
Closed

Add package.json to exports #30

wants to merge 1 commit into from

Conversation

Reeywhaar
Copy link

Missing package.json in "exports" creates warning in react-native. See uuidjs/uuid#444 for context

Missing package.json in "exports" creates warning in react-native. See uuidjs/uuid#444 for context
@jviide
Copy link
Contributor

jviide commented Dec 1, 2022

Hi! Thank you for this pull request. After applying these changes Node.js v19 throws the following error when trying to import Valita with import * as v from "@badrap/valita":

Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config
/.../node_modules/@badrap/valita/package.json while importing file:///.../test.mjs.
"exports" cannot contain some keys starting with '.' and some not. The exports
object must either be an object of package subpath keys or an object of main
entry condition name keys only.

After looking a bit into the original issue with react-native, we tend to agree with D3.js's maintainer that this is best fixed in tooling side. In this case upgrading to react-native v0.69.4 or @react-native-community/cli v8.0.4 (or newer versions of them) should help.

However, thank you again for bringing this to our attention, we appreciate it 🙂

@jviide jviide closed this Dec 1, 2022
@jviide
Copy link
Contributor

jviide commented Dec 1, 2022

Oh, right, forgot to add: The Node.js error could be fixed by just putting the "node" and "default" keys under a "." key.

    "./package.json": "./package.json",
    ".": {
      "node": { ... },
      "default": ...
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants