diff --git a/package.json b/package.json index 19c499f..5f610b5 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "repository": "github:aidlran/adamant", "bugs": "https://github.com/aidlran/adamant/issues", "homepage": "https://github.com/aidlran/adamant#readme", - "main": "./dist/signal/index.js", - "types": "./dist/signal/index.d.ts", + "main": "./dist/cjs/signal/index.js", + "types": "./dist/cjs/signal/index.d.ts", "type": "module", "sideEffects": false, "files": [ @@ -16,12 +16,19 @@ ], "exports": { ".": { - "types": "./dist/signal/index.d.ts", - "default": "./dist/signal/index.js" + "import": { + "types": "./dist/mjs/signal/index.d.ts", + "default": "./dist/mjs/signal/index.js" + }, + "require": { + "types": "./dist/cjs/signal/index.d.ts", + "default": "./dist/cjs/signal/index.js" + } } }, "scripts": { - "build": "rm -dr dist; tsc", + "build": "rm -dr dist; tsc && npm run build:cjs", + "build:cjs": "tsc --module commonjs --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json", "lint": "publint", "prepack": "npm run build", "start": "tsc --watch --preserveWatchOutput" diff --git a/tsconfig.json b/tsconfig.json index b102793..33a0d0d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "outDir": "./dist", + "module": "NodeNext", + "outDir": "./dist/mjs", "sourceMap": true, "strict": true, },