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

gh-43: Full support for ESM modules. #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -7,9 +7,9 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types should always go first. See typescript doc

"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
"import": "./dist/index.mjs"
}
},
"engines": {
Expand All @@ -18,11 +18,12 @@
"files": [
"/dist/index.js",
"/dist/index.mjs",
"/dist/index.d.ts"
"/dist/index.d.ts",
"/dist/index.d.mts"
],
"scripts": {
"test": "tsc -noEmit -p tsconfig-test.json && jest --useStderr --runInBand --detectOpenHandles",
"build": "npm run lint && tsup src/index.ts --format cjs,esm --dts --clean --platform neutral --minify",
"build": "npm run lint && tsup src/index.ts --format cjs,esm --dts --clean --platform neutral --minify && cp ./dist/index.d.ts ./dist/index.d.mts",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply duplicate declaration file with d.mts extension. This will make typescript compiler happy because for .mjs module types will be visible.

"prepack": "npm run build",
"lint": "eslint --ext .ts,.js .",
"lint:fix": "npm run lint -- --fix",
Expand Down