Skip to content

Commit

Permalink
Use conditional exports for node.js (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj authored Jul 27, 2020
1 parent e261d25 commit 2fd55b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
"types": "dist/index.d.ts",
"main": "dist/haws.umd.js",
"module": "dist/index.js",
"exports": {
"node": {
"import": "./dist/index.js",
"require": "./dist/haws.cjs"
}
},
"repository": {
"url": "https://github.com/home-assistant/home-assistant-js-websocket.git",
"type": "git"
},
"scripts": {
"watch": "tsc --watch",
"build": "tsc && rollup dist/index.js --format umd --name HAWS --file dist/haws.umd.js",
"build": "tsc && rollup -c",
"test": "tsc && mocha",
"prepublishOnly": "rm -rf dist && yarn build && npm test"
},
Expand Down
14 changes: 14 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
input: "dist/index.js",
output: [
{
file: "dist/haws.cjs",
format: "cjs",
},
{
file: "dist/haws.umd.js",
format: "umd",
name: "HAWS",
},
],
};

0 comments on commit 2fd55b5

Please sign in to comment.