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

Fix exports map to support loading in Node esm #425

Merged
merged 4 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
/npm-debug.log
.DS_Store
/match/*.js
/match/*.mjs
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/dist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down