Skip to content

Commit

Permalink
Added seperate support for cjs and mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
DhyeyMoliya committed Dec 20, 2021
1 parent 089e45a commit 51bf556
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "json-obj-diff",
"version": "1.1.0",
"version": "1.2.0",
"description": "A tiny library to find difference between two json objects",
"main": "index.js",
"types": "index.d.ts",
"type": "module",
"scripts": {
"test": "npm run build && ts-node ./test/index.js",
"build": "tsc",
"build": "tsc -p tsconfig.cjs.json && mv dist/index.js dist/index.cjs && tsc -p tsconfig.json",
"package": "rm -rf dist && npm run build && rm -rf package && cp -r dist package && cp package.json README.md LICENSE.md package/"
},
"repository": {
Expand All @@ -32,7 +33,10 @@
},
"exports": {
"./package.json": "./package.json",
".": "./index.js",
".": {
"require": "./index.cjs",
"import": "./index.js"
},
"./index.d.ts": "./index.d.ts"
}
}
14 changes: 14 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"moduleResolution": "node",
"esModuleInterop": true,
"noImplicitAny": false,
"sourceMap": false,
"outDir": "dist",
"declaration": true,
"allowSyntheticDefaultImports": true,
},
"include": [
"src/**/*"
],
}
7 changes: 7 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"target": "esnext"
},
}
20 changes: 3 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "node",
"module": "es2020",
"target": "es2019",
"esModuleInterop": true,
"noImplicitAny": false,
"sourceMap": false,
"outDir": "dist",
"declaration": true,
"allowSyntheticDefaultImports": true,
"module": "esnext",
"target": "esnext"
},
"include": [
"src/**/*"
],
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
}

0 comments on commit 51bf556

Please sign in to comment.