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: "exports" to include the debug entry #5

Merged
merged 1 commit into from
Apr 23, 2023
Merged

chore: "exports" to include the debug entry #5

merged 1 commit into from
Apr 23, 2023

Conversation

maraisr
Copy link
Contributor

@maraisr maraisr commented Apr 21, 2023

The package is configured with type: module but trying to import the /debug entry throws this error:

Package subpath './debug' is not defined by "exports"

lets add it.

Wasn't sure if we need a debug.d.ts, not sure how Typescript will behave with it missing, but it feels right.

Copy link
Owner

@TomerAberbach TomerAberbach left a comment

Choose a reason for hiding this comment

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

Thanks! LG, but just have a question about one of the changes.

"types":"./src/debug.d.ts",
"import": "./dist/debug.js"
},
"./package.json": "./package.json"
Copy link
Owner

Choose a reason for hiding this comment

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

Curious why this is needed? Do people typically need to import package.json for some reason?

Copy link
Contributor Author

@maraisr maraisr Apr 23, 2023

Choose a reason for hiding this comment

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

not typically people, but machines do. and without this listing, node fails to tell the bundler about the export map.

here's a few examples:

svelte: https://github.com/sveltejs/svelte/blob/master/package.json#L24
polka: https://github.com/lukeed/polka/blob/next/packages/polka/package.json#L15
vite: https://github.com/vitejs/vite/blob/main/packages/vite/package.json#L31

but think maybe @lukeed has a better answer for you.

Copy link

Choose a reason for hiding this comment

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

it's just a good idea to have in general. things like rollup plugins may try to access a package.json file directly, so this just wards off the inevitable request to expose it

@TomerAberbach TomerAberbach merged commit 7a2b378 into TomerAberbach:main Apr 23, 2023
@TomerAberbach
Copy link
Owner

Released!

@maraisr maraisr deleted the adds-debug-to-exports branch April 23, 2023 22:28
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