Skip to content

Commit

Permalink
refactor: export cjs and esm modules (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu authored and derberg committed Oct 4, 2022
1 parent ac49c9f commit 5048612
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_modules
/docs
/coverage
/lib
/esm
/cjs
/browser
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_modules
/docs
/coverage
/lib
/esm
/cjs
/browser
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
"license": "Apache-2.0",
"homepage": "https:/asyncapi/parser-js",
"sideEffects": false,
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "esm/index.d.ts",
"files": [
"./lib",
"./browser",
"/esm",
"/cjs",
"/browser",
"LICENSE",
"README.md"
],
"scripts": {
"build": "tsc",
"build": "npm run build:esm && npm run build:cjs && npm run build:browser",
"build:esm": "tsc",
"build:cjs": "tsc --project ./tsconfig.cjs.json",
"build:browser": "webpack",
"test": "npm run test:unit && npm run test:browser",
"test:unit": "cross-env CI=true jest --coverage --testPathIgnorePatterns=test/browser/*",
Expand Down
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.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./cjs"
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"outDir": "./lib",
"outDir": "./esm",
"baseUrl": "./src",
"target": "es6",
"module": "esnext",
"lib": [
"esnext",
"DOM"
Expand All @@ -15,7 +16,6 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
Expand Down

0 comments on commit 5048612

Please sign in to comment.