Skip to content

Commit 732416a

Browse files
Improve tree shakability (#612)
* Add `sideEffects: false` to `libesm/package.json` * Make tweaks I proposed in convo at #612 * Fix build for Unix (and break it again for Windows in the process) * Use `node --eval` * --target es6 for ESM build @fisker points out at #612 (comment) that ESM modules aren't usable by ES5 environments anyway, so targeting ES5 is pointless --------- Co-authored-by: Mark Amery <markrobertamery@gmail.com>
1 parent 0365f4b commit 732416a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
"clean": "rm -rf libcsm/ libesm/ dist/ coverage/ .nyc_output/",
7272
"lint": "yarn eslint",
7373
"build": "yarn lint && yarn generate-esm && yarn generate-cjs && yarn check-types && yarn run-rollup && yarn run-uglify",
74-
"generate-cjs": "yarn tsc --module commonjs --outDir libcjs && echo '{\"type\": \"commonjs\"}' > libcjs/package.json",
75-
"generate-esm": "yarn tsc --module nodenext --outDir libesm && echo '{\"type\": \"module\"}' > libesm/package.json",
74+
"generate-cjs": "yarn tsc --module commonjs --outDir libcjs && node --eval \"fs.writeFileSync('libcjs/package.json', JSON.stringify({type:'commonjs',sideEffects:false}))\"",
75+
"generate-esm": "yarn tsc --module nodenext --outDir libesm --target es6 && node --eval \"fs.writeFileSync('libesm/package.json', JSON.stringify({type:'module',sideEffects:false}))\"",
7676
"check-types": "yarn run-tsd && yarn run-attw",
7777
"test": "nyc yarn _test",
7878
"_test": "yarn build && cross-env NODE_ENV=test yarn run-mocha",

0 commit comments

Comments
 (0)