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

chore(compat): add package.json to exports #3755

Merged

Conversation

akselander
Copy link
Contributor

Summary

When I switched from webpack aliasing react to preact, to doing it on package level in an Next.JS codebase I ran into a problem - storybook was throwing error - webpack was trying to access package.json, but it wasn't defined in the exports.

Adding this inside of package.json helped my case, but if this not is not how we should approach it, please guide me towards a better solution.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks a bunch for the PR. Let's simplify it a bit since .json doesn't need format specifiers and then it's ready to be merged 👍

Comment on lines 48 to 51
"./package.json": {
"import": "./package.json",
"require": "./package.json"
}
Copy link
Member

Choose a reason for hiding this comment

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

This can be simplified a bit, since the formats do not differ. See the main package.json file:

"./package.json": "./package.json",

Suggested change
"./package.json": {
"import": "./package.json",
"require": "./package.json"
}
"./package.json": "./package.json"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, makes sense!

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the PR 🎉

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.529% when pulling 4362700 on akselander:chore/compat/add-package into 284a8b0 on preactjs:master.

@marvinhagemeister marvinhagemeister merged commit 820bff3 into preactjs:master Oct 4, 2022
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

3 participants