diff --git a/.gitignore b/.gitignore index 32ccb95..5cbd5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules /npm-debug.log .DS_Store /match/*.js +/match/*.mjs diff --git a/package.json b/package.json index e822231..a953100 100644 --- a/package.json +++ b/package.json @@ -10,20 +10,21 @@ "unpkg": "dist/preact-router.umd.js", "exports": { ".": { - "module": "./dist/preact-router.module.js", - "import": "./dist/preact-router.module.js", + "module": "./dist/preact-router.mjs", + "import": "./dist/preact-router.mjs", "require": "./dist/preact-router.js" }, "./package.json": "./package.json", "./match": { - "module": "./match/index.module.js", - "import": "./match/index.module.js", + "module": "./match/index.mjs", + "import": "./match/index.mjs", "require": "./match/index.js" }, "./match/package.json": "./match/package.json" }, "scripts": { "build": "microbundle -f es --no-generateTypes && microbundle src/cjs.js -f cjs,umd --no-generateTypes && (cd match && npm run build)", + "postbuild": "cp dist/preact-router.module.js dist/preact-router.mjs && cp match/index.module.js match/index.mjs", "test": "npm-run-all lint build test:unit test:ts", "lint": "eslint src test", "fix": "npm run lint -- --fix", diff --git a/test/dist.test.js b/test/dist.test.js index 1c7d8eb..9c3e92f 100644 --- a/test/dist.test.js +++ b/test/dist.test.js @@ -2,7 +2,7 @@ import { h } from 'preact'; import { toBeCloneOf } from './utils/assert-clone-of'; // import '../test_helpers/assert-clone-of'; -const router = require('../dist/preact-router'); +const router = require('../dist/preact-router.js'); const { Router, Link, route } = router; describe('dist', () => {