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

Added "./package.json" to "exports" field #273

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/@magic-ext/solana/package.json
Expand Up @@ -20,7 +20,8 @@
"react-native": "./dist/react-native/index.native.js",
"exports": {
"import": "./dist/es/index.mjs",
"require": "./dist/cjs/index.js"
"require": "./dist/cjs/index.js",
"./package.json": "./package.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a linter warning coming from VSCode's package.json schema-checker. Not sure if this is actually an issue in practice. Do you have any context @bmeeder22?

The warning disappears when conditional "exports" are not in use. I'm not sure if this is a limitation of the spec, or of the schema reference.

Screen Shot 2022-01-25 at 7 55 52 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The place that I am seeing warnings is while attempting to use this package in react-native:

yarn run v1.22.17

$ react-native start
warn Package @magic-ext/solana has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/.../mobile/node_modules/@magic-ext/solana/package.json

This appears to be unique to react native >= Node V14 as per this issue: react-native-community/cli#1168

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the warning is in the VS Code linter and not eslint. My guess is that your seeing that error only as part of the VS Code built in linter which might not have the most updated spec.

It appears that this only matters when there are defined exports. In packages without explicitly defined exports everything works just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good thing to note that the warning appears to just be a warning initializing the extension is working just fine in the RN application. Hopefully that doesn't change in some later version.

},
"externals": {
"include": [
Expand Down