Skip to content

Commit

Permalink
feat: Add CommonJS export for parse5 module (#418)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Titus <tituswormer@gmail.com>
  • Loading branch information
3 people committed Mar 2, 2022
1 parent 1615a5e commit 7e83c88
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -24,7 +24,9 @@
"typescript": "^4.5.5"
},
"scripts": {
"build": "tsc --build packages/* test",
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc --build packages/* test",
"build:cjs": "tsc -p packages/parse5/tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > packages/parse5/dist/cjs/package.json",
"prettier": "prettier '**/*.{js,ts,md,json,yml}' --loglevel warn",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
Expand Down
10 changes: 9 additions & 1 deletion packages/parse5/package.json
Expand Up @@ -27,7 +27,15 @@
"serialize"
],
"license": "MIT",
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "dist/index.js",
"require": "dist/cjs/index.js"
}
},
"repository": {
"type": "git",
"url": "git://github.com/inikulin/parse5.git"
Expand Down
8 changes: 8 additions & 0 deletions packages/parse5/tsconfig.cjs.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"target": "ES6",
"outDir": "dist/cjs"
}
}

0 comments on commit 7e83c88

Please sign in to comment.