Skip to content

Commit

Permalink
feat(esmodule): output esmodule along with commonjs
Browse files Browse the repository at this point in the history
BREAKING CHANGE: specifies "module" field in package.json
  • Loading branch information
Hoishin committed Mar 3, 2019
1 parent 284a384 commit 640153d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
"license": "MIT",
"author": "Keiichiro Amemiya <hoishinxii@gmail.com>",
"files": [
"out",
"cjs",
"esm",
"src",
"!src/__tests__"
],
"main": "out/index.js",
"types": "out/index.d.ts",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "cjs/index.d.ts",
"scripts": {
"alpha": "npm version prerelease --preid=alpha",
"beta": "npm version prerelease --preid=beta",
"prebuild": "del out",
"build": "tsc",
"prepublishOnly": "yarn && yarn build",
"pretest": "yarn build",
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
"prepublishOnly": "yarn build",
"test": "jest",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
},
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "commonjs",
"outDir": "cjs"
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"node_modules/nodecg/types/browser.d.ts"
],
"exclude": ["**/__tests__"]
}
13 changes: 13 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "es2015",
"outDir": "esm"
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"node_modules/nodecg/types/browser.d.ts"
],
"exclude": ["**/__tests__"]
}
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
"extends": "@hoishin/tsconfig",
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["es2018", "dom"],
"jsx": "react",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "out",

"moduleResolution": "node"
},
"include": [
Expand Down

0 comments on commit 640153d

Please sign in to comment.