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

fix: always create package.json with type regardless of esm option #598

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

satya164
Copy link
Member

This will provide more flexibilty to library authors such as specifying type: module in their project's package.json without breaking the commonjs output for the published code.

this will provide more flexibilty to library authors such as specifying `type: module` in their project's `package.json` without breaking the commonjs output for the published code.
@satya164 satya164 added this pull request to the merge queue Jul 26, 2024
Merged via the queue into main with commit 5b45554 Jul 26, 2024
32 checks passed
@satya164 satya164 deleted the @satya164/esm-package-json branch July 26, 2024 10:34
@zoontek
Copy link

zoontek commented Sep 14, 2024

@atlj @satya164 Note that if like me you are using bob to build your Expo plugin too, it breaks as the Expo findUpPlugin function (in charge of locating the nearest package.json) will now stop at the current directory (dist/commonjs) as there's a package.json in it.

And it will break prebuild:

CommandError: Package "react-native-bootsplash" does not contain a valid config plugin.
Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin

Cannot use import statement outside a module

@satya164
Copy link
Member Author

@atlj @satya164 Note that, if like me you are using bob to build your Expo plugin too, it breaks as the Expo findUpPlugin function, in charge of locating the nearest package.json, will now stop at the current directory (dist/commonjs) as there's a package.json in it.

And it will break prebuild:


CommandError: Package "react-native-bootsplash" does not contain a valid config plugin.

Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin



Cannot use import statement outside a module

Seems like a bug to be fixed there as this is also a pattern in other build tools like tshy

@zoontek
Copy link

zoontek commented Sep 14, 2024

@satya164 How? By modifying the findUpPlugin fn to check for main or exports properties?

@satya164
Copy link
Member Author

@satya164 How? By modifying the findUpPlugin fn to check for main or exports properties?

Not familiar with why it looks for package.json, but if it's trying to find a package, it should check that the package.json has a name property.

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.

3 participants