Skip to content

Commit

Permalink
Mark build output "sideEffects": false (#23501)
Browse files Browse the repository at this point in the history
## Description

During the build we copy package.json files into the output for CJS
builds and some ESM builds. Thes files lacked `"sideEffects": false`
resulting in poor tree shaking for any bundle using build output with a
copied package.json. This included the tree package ESM build which
caused its bundle to bloat.

This package.json copy has been removed from the tree package's esm
build, but also update to include `"sideEffects": false` for builds that
use it.
  • Loading branch information
CraigMacomber authored Jan 8, 2025
1 parent ddce270 commit 62836c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion common/build/build-common/src/cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"type": "commonjs"
"type": "commonjs",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion common/build/build-common/src/esm/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"type": "module"
"type": "module",
"sideEffects": false
}
2 changes: 1 addition & 1 deletion packages/dds/tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:esnext": "tsc --project ./tsconfig.json && copyfiles -f ../../../common/build/build-common/src/esm/package.json ./lib",
"build:esnext": "tsc --project ./tsconfig.json",
"build:genver": "gen-version",
"build:test": "npm run build:test:esm && npm run build:test:cjs",
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
Expand Down

0 comments on commit 62836c0

Please sign in to comment.