-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
feat: enable support for exports condition #502
Conversation
do we need additional tests, eg a scenario with mixes svelte field and exports condition? Is the usage i described above what we want to go for? "exports": {
// boohoo, didn't work in my tests
"./*.svelte": {
"svelte": "./src/components/*.svelte"
},
".": {
"svelte": "./index.js"
}
} We only ever expect libraries to use the |
I wonder if it's just |
Yeah I think this should technically work too, hoping it's only a bug on not some hidden nodejs spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit but lgtm!
This PR enables using an export condition
svelte
to point at svelte source files.eg this exports map
allows you to either
import {SomeThing} from 'some-lib'
when index.js exports SomeThing, orimport SomeThing from 'some-lib/SomeThing.svelte'
if you prefer a deep import to avoid the index.This is a very simplistic example and the real usecase is to still allow exporting compiled svelte files or other js files via the import condition.
See https://nodejs.org/api/packages.html#conditional-exports for what you can do with export conditions.