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

Need a way to add an export condition "svelte" #10050

Open
PixievoltNo1 opened this issue Dec 13, 2024 · 0 comments
Open

Need a way to add an export condition "svelte" #10050

PixievoltNo1 opened this issue Dec 13, 2024 · 0 comments

Comments

@PixievoltNo1
Copy link

PixievoltNo1 commented Dec 13, 2024

🙋 feature request

When publishing a package containing Svelte components, Svelte conventions dictate that the uncompiled Svelte component is made available using the svelte export condition in package.json, like so (example taken from svelte-french-toast's package.json:

	"exports": {
		".": {
			"types": "./dist/index.d.ts",
			"svelte": "./dist/index.js"
		}
	},

For this to work with a Svelte transformer plugin, Parcel needs to know to use the svelte condition.

🤔 Expected Behavior

Either the Parcel user or a transformer plugin author should be able to globally add the svelte condition to Parcel's resolver.

😯 Current Behavior

Transformers can only add conditions for dependencies they are directly adding. Users can't add export conditions at all.

💁 Possible Solution

The transformers API could be extended to provide a way to add export conditions that are then used globally for all imports. This could be as simple as a property with an array of strings on the object passed to new Transformer.

Alternatively, the existing "@parcel/resolver-default" object for package.json could get a new property for specifying export conditions to add, and Svelte transformers could add to their documentation that you should put svelte there. This is similar to the solution used by rollup-plugin-svelte.

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

No branches or pull requests

1 participant