Skip to content

Commit 3057f50

Browse files
committed
fix esm & cjs
1 parent b80f3ba commit 3057f50

8 files changed

Lines changed: 592 additions & 37 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ jobs:
8585
${{steps.get-versions.outputs.pkg}} run build
8686
tmp=$(mktemp)
8787
jq --arg version "${{ github.event.release.tag_name }}" '.version = $version' package.json > $tmp
88-
jq 'del(.type)' $tmp > package.json
88+
mv $tmp > package.json
89+
echo '{ "type": "module" }' >> lib/mjs/package.json
8990
echo version=$(jq -r '.version' package.json) >> $GITHUB_OUTPUT
9091
9192
- name: Publish

.mocharc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ extension: ['ts', 'tsx'] # add tsx if you use react
22
spec: 'src/**/*.spec.ts'
33
require: 'ts-node/register'
44
timeout: '3000'
5-
experimental-specifier-resolution: 'node'
6-
loader: 'ts-node/esm'

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"url": "https://github.com/namebeta/node-dan-api/issues"
1414
},
1515
"version": "0.0.1",
16-
"type": "module",
1716
"exports": {
1817
".": {
1918
"types": "./lib/types/index.d.ts",
@@ -27,7 +26,7 @@
2726
"types": "lib/types/index.d.ts",
2827
"scripts": {
2928
"clear": "rm -rf ./lib",
30-
"build:esm": "npx tsc",
29+
"build:esm": "npx tsc && npx tsc-esm-fix --tsconfig tsconfig.json",
3130
"build:cjs": "npx tsc -p tsconfig.cjs.json",
3231
"build": "npm run clear && npm run build:esm && npm run build:cjs",
3332
"test": "npx mocha"
@@ -38,6 +37,7 @@
3837
"assert": "latest",
3938
"mocha": "latest",
4039
"ts-node": "latest",
40+
"tsc-esm-fix": "latest",
4141
"typescript": "latest"
4242
},
4343
"engines": {

0 commit comments

Comments
 (0)