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(package): add exports map to package.json #77

Merged
merged 6 commits into from
Jan 1, 2024

Conversation

harshmandan
Copy link
Contributor

@harshmandan harshmandan commented Dec 20, 2023

Fixes #76

@harshmandan harshmandan changed the title Add the missing exports condition to support vite-plugin-svelte:v3 Add the missing exports condition to support vite-plugin-svelte v3 Dec 20, 2023
Copy link
Owner

@metonym metonym left a comment

Choose a reason for hiding this comment

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

Thank you for this PR.

To add some context, I've backported a fix for v0.10.2 to include the exports map. This had to be done since the current master has breaking, unreleased changes.

However, this PR is still necessary to add an exports map.

@@ -1,13 +1,17 @@
{
"name": "svelte-intersection-observer",
"version": "0.10.1",
"version": "0.10.2",
Copy link
Owner

Choose a reason for hiding this comment

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

This change can be undone since I manually add a separate commit for a version bump.

package.json Outdated
Comment on lines 11 to 14
"exports": {
".": {
"svelte": "./src/index.js"
},
Copy link
Owner

Choose a reason for hiding this comment

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

This is a good start, but more fields are necessary.

For example, an explicit entry point for types must be set. In addition, it's also nice to map subpaths (e.g., directly importing svelte-intersection-observer/src/IntersectionObserver.svelte). Without these, type errors will occur.

"exports": {
  ".": {
    "types": "./types/index.d.ts",
    "svelte": "./src/index.js"
  },
  "./src/*.svelte": {
    "types": "./src/*.svelte.d.ts",
    "import": "./src/*.svelte"
  },
  "./src/*": {
    "types": "./src/*.d.ts",
    "import": "./src/*.js"
  }
},

@metonym metonym changed the title Add the missing exports condition to support vite-plugin-svelte v3 fix(package): add exports map to package.json Jan 1, 2024
@metonym metonym merged commit e8f815c into metonym:master Jan 1, 2024
1 check passed
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.

Warning with vite-plugin-svelte
2 participants