diff --git a/package.json b/package.json index 7318743..aa1de24 100644 --- a/package.json +++ b/package.json @@ -24,16 +24,16 @@ "dist/*" ], "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "dist/cjs/index.js", + "types": "dist/types/index.d.ts", "module": "dist/index.mjs", "exports": { - "import": "./dist/index.mjs", - "require": "./dist/index.js" + "import": "./dist/esm/index.mjs", + "require": "./dist/cjs/index.js" }, "scripts": { - "build:cjs": "babel src --out-dir dist --extensions \".ts\" --out-file-extension .js", - "build:esm": "BABEL_ESM=true babel src --out-dir dist --extensions \".ts\" --out-file-extension .mjs", + "build:cjs": "babel src --out-dir dist/cjs --extensions \".ts\"", + "build:esm": "BABEL_ESM=true babel src --out-dir dist/esm --extensions \".ts\"", "build:tsc": "tsc --emitDeclarationOnly", "build": "yarn build:cjs && yarn build:esm && yarn build:tsc", "lint": "eslint src --ext .js,.ts", @@ -73,7 +73,7 @@ "babel-jest": "^26.6.3", "common-tags": "^1.8.0", "eslint": "^7.23.0", - "jest": "^26.6.3", + "jest": "^26.6.3", "prettier": "^2.2.1", "regenerator-runtime": "^0.13.7", "typescript": "^4.2.3" diff --git a/test/browser/index.test.js b/test/browser/index.test.js index 64cf8be..805bade 100644 --- a/test/browser/index.test.js +++ b/test/browser/index.test.js @@ -1,5 +1,5 @@ import * as src from '../../src'; -import * as dist from '../../dist'; +import * as dist from '../../dist/cjs'; const tests = ({ stringify, parse }) => { test('HTML Event', () => { diff --git a/test/common/index.test.js b/test/common/index.test.js index 90ae6bb..092dcd9 100644 --- a/test/common/index.test.js +++ b/test/common/index.test.js @@ -1,5 +1,5 @@ import * as src from '../../src'; -import * as dist from '../../dist'; +import * as dist from '../../dist/cjs'; const regex1 = /foo/; const regex2 = /foo/g; diff --git a/test/node/index.test.js b/test/node/index.test.js index da2244c..a0aaeed 100644 --- a/test/node/index.test.js +++ b/test/node/index.test.js @@ -1,5 +1,5 @@ import * as src from '../../src'; -import * as dist from '../../dist'; +import * as dist from '../../dist/cjs'; const tests = ({ stringify }) => { test('stringify the global object', () => { diff --git a/tsconfig.json b/tsconfig.json index beddd04..7f2ccfc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "noImplicitAny": true, "esModuleInterop": true, "types": ["jest"], - "outDir": "dist" + "outDir": "dist/types" }, "include": ["src"], "exclude": ["dist"]