#10050·parcel

Need a way to add an export condition "svelte"

Author: PixievoltNo1Created Dec 13, 2024Updated Aug 20, 2026

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:

javascript
	"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.