diff --git a/package.json b/package.json index 98697a3ad..1ca46ab8d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,10 @@ "main": "./build/cjs/index.js", "module": "./build/esm/index.js", "exports": { - "import": "./build/esm/index.js", + "import": { + "node": "./build/esm-debug/index.js", + "default": "./build/esm/index.js" + }, "require": "./build/cjs/index.js" }, "types": "build/esm/index.d.ts", @@ -70,7 +73,7 @@ "zuul-ngrok": "4.0.0" }, "scripts": { - "compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && cp ./support/package.cjs.json ./build/cjs/package.json && cp ./support/package.esm.json ./build/esm/package.json", + "compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && ./postcompile.sh", "test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi", "test:node": "mocha --bail --reporter dot --require test/support/server.js test/index.js", "test:browser": "zuul test/index.js", diff --git a/postcompile.sh b/postcompile.sh new file mode 100755 index 000000000..b9e0eebcd --- /dev/null +++ b/postcompile.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cp ./support/package.cjs.json ./build/cjs/package.json +cp ./support/package.esm.json ./build/esm/package.json + +cp -r ./build/esm/ ./build/esm-debug/ + +sed -i '/debug(/d' ./build/esm/*.js ./build/esm/**/*.js