Skip to content

support package.json exports["."].svelte #1234

@hatemhosny

Description

@hatemhosny

Assuming we are in a svelte component and want to import other svelte components in a published package.
It would be nice if esm.sh can use the svelte entry of exports

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

example: https://app.unpkg.com/@onsvisual/[email protected]/files/package.json#L35

To allow usage like this:
https://onsdigital.github.io/svelte-components/?path=/docs/introduction--docs#using-the-components

<!-- +layout.svelte -->
<script>
  import "@onsvisual/svelte-components/css/main.css";
</script>

<slot/>

<!-- +page.svelte / Component.svelte -->
<script>
  import { Section } from "@onsvisual/svelte-components";
</script>

<Section title="Hello world!">I am using an ONS Svelte component.</Section>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions