Skip to content

Commit 6a45f1a

Browse files
authored
Merge pull request #12 from kjagiello/esm-import-fix
Fix importing as ESM by using conditional exports
2 parents a9fb267 + 6521c22 commit 6a45f1a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"svelte": "src/index.js",
77
"module": "dist/index.mjs",
88
"main": "dist/index.js",
9+
"exports": {
10+
"require": "./dist/index.js",
11+
"import": "./dist/index.mjs"
12+
},
913
"scripts": {
1014
"tailwind:watch": "chokidar 'docs/tailwind*.*' -c 'npm run tailwind:build'",
1115
"tailwind:build": "tailwind build docs/tailwind.css -c docs/tailwind.config.js -o docs/build/global.css",

src/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
import SvelteToast from './SvelteToast.svelte'
2-
import { toast } from './stores'
3-
4-
export { SvelteToast, toast }
1+
export { default as SvelteToast } from './SvelteToast.svelte'
2+
export { toast } from './stores'

0 commit comments

Comments
 (0)