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

export package.json #727

Merged
merged 1 commit into from Sep 1, 2021
Merged

Conversation

odeniso
Copy link

@odeniso odeniso commented Aug 31, 2021

rollup-plugin-svelte: The following packages did not export their `package.json` file so we could not check the `svelte` field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.

here is some more context from within the svelte project

@carhartl
Copy link
Member

@carhartl
Copy link
Member

I‘d rather not litter the package.json with non-standard fields, and it seems it isn‘t strictly necessary according to aforementioned documentation.

@lukeed
Copy link

lukeed commented Sep 1, 2021

No, it's about the "package.json" not being accessible to the outside world. Doesn't matter who or what is trying to read the package.json file, anything outside of this module's own files can't look at the file cuz it's not defined as an export.

This is very standard & has been part of the ESM resolution algorithm and official documentation + example since very early days.

@odeniso
Copy link
Author

odeniso commented Sep 1, 2021

Thanks for the quick look @carhartl!

As @lukeed mentions above, this is not introducing the non-standard field (I assume you are referring the the "svelte" property). It is merely exposing the package's package.json file, which is often assumed to be accessible:

Warning: Introducing the "exports" field prevents consumers of a package from using any entry points that are not defined, including the package.json (e.g. require('your-package/package.json'). This will likely be a breaking change.
https://nodejs.org/api/packages.html#packages_package_entry_points

@carhartl carhartl reopened this Sep 1, 2021
@carhartl carhartl merged commit 2a8d172 into js-cookie:master Sep 1, 2021
@carhartl
Copy link
Member

carhartl commented Sep 1, 2021

Thanks for the PR, and apologies for taking too quick a look..

@lukeed
Copy link

lukeed commented Sep 1, 2021

Thanks, appreciate it!

@odeniso odeniso deleted the export-package-json branch September 1, 2021 06:30
@carhartl
Copy link
Member

carhartl commented Sep 1, 2021

@odeniso @lukeed I've created a new release so the fix becomes available: https://github.com/js-cookie/js-cookie/releases/tag/v3.0.1

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

Successfully merging this pull request may close these issues.

None yet

4 participants