diff --git a/package.json b/package.json index eb9fb2147..0dfda473b 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,8 @@ "typescript": "^4.6.3" }, "scripts": { - "build": "npm run build:esm && npm run build:cjs", + "build": "npm run build:esm && npm run build:cjs --workspaces --if-present", "build:esm": "tsc --build packages/* test", - "build:cjs": "tsc -p packages/parse5/tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > packages/parse5/dist/cjs/package.json", "build:docs": "node --max-old-space-size=8192 node_modules/.bin/typedoc .", "prettier": "prettier '**/*.{js,ts,md,json,yml}' --loglevel warn", "format": "npm run format:es && npm run format:prettier", diff --git a/packages/parse5-htmlparser2-tree-adapter/package.json b/packages/parse5-htmlparser2-tree-adapter/package.json index 8d86c29ee..2e35f8bfe 100644 --- a/packages/parse5-htmlparser2-tree-adapter/package.json +++ b/packages/parse5-htmlparser2-tree-adapter/package.json @@ -14,14 +14,20 @@ "htmlparser2" ], "license": "MIT", - "main": "dist/index.js", + "main": "dist/cjs/index.js", "module": "dist/index.js", "types": "dist/index.d.ts", - "exports": "./dist/index.js", + "exports": { + "import": "./dist/index.js", + "require": "./dist/cjs/index.js" + }, "dependencies": { "domhandler": "^4.3.1", "parse5": "^6.0.1" }, + "scripts": { + "build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json" + }, "repository": { "type": "git", "url": "git://github.com/inikulin/parse5.git" diff --git a/packages/parse5/package.json b/packages/parse5/package.json index 5266364e2..87026be80 100644 --- a/packages/parse5/package.json +++ b/packages/parse5/package.json @@ -32,10 +32,11 @@ "module": "dist/index.js", "types": "dist/index.d.ts", "exports": { - ".": { - "import": "./dist/index.js", - "require": "./dist/cjs/index.js" - } + "import": "./dist/index.js", + "require": "./dist/cjs/index.js" + }, + "scripts": { + "build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json" }, "repository": { "type": "git", diff --git a/packages/parse5/tsconfig.cjs.json b/packages/parse5/tsconfig.cjs.json deleted file mode 100644 index 760382867..000000000 --- a/packages/parse5/tsconfig.cjs.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS", - "target": "ES6", - "outDir": "dist/cjs" - } -}