Skip to content

Commit d8e968e

Browse files
authored
feat: add "sideEffects": false to package.json files for all packages (#1343)
Fixes #1136 Added sideEffects: false to enable tree-shaking I have added the "sideEffects": false property to the package.json files of the OpenFeature JS SDK packages. This signals to bundlers (like Webpack) that the files in these packages do not contain side effects and can be safely tree-shaken if unused. Changes I updated the package.json for the following packages: packages/nest packages/react packages/server packages/shared packages/web The packages/angular package already had this flag. Example Change ```diff "devDependencies": { "@openfeature/core": "^1.9.0" - } + }, + "sideEffects": false } ``` Verification 1. Codebase Audit I performed a search of the codebase for potential side effects, including: Modifications to `window` or `global` objects. Immediate code execution on import. Polyfills or monkey-patching. CSS/asset imports. No side effects were found in the source code of the SDKs. The only occurrences of window/global were in test files or within functions/methods, which is safe. 2. Build Verification I ran `npm run build` to ensure the packages still build correctly with the new flag. Result: Build successful. 3. Test Verification I run `npm run test` (including Jest and Angular tests) to ensure no functionality was broken. Result: All 35 Jest test suites and 32 Angular tests passed. 4. Additional Verification To ensure no negative impact: Linting: Ran `npm run lint` across all packages. All files passed. Artifact Inspection: Visually verified the `dist` directories to ensure build output is complete and structured correctly. Signed-off-by: Mridul Tailor <mtailor729@gmail.com> Signed-off-by: Mridul Tailor <71081929+MridulTailor@users.noreply.github.com>
1 parent 07693eb commit d8e968e

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

packages/nest/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@
6060
"@openfeature/server-sdk": "1.18.0",
6161
"@types/supertest": "^6.0.0",
6262
"supertest": "^7.0.0"
63-
}
63+
},
64+
"sideEffects": false
6465
}

packages/react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
"devDependencies": {
5454
"@openfeature/core": "*",
5555
"@openfeature/web-sdk": "*"
56-
}
56+
},
57+
"sideEffects": false
5758
}

packages/server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@
5252
},
5353
"devDependencies": {
5454
"@openfeature/core": "^1.9.2"
55-
}
55+
},
56+
"sideEffects": false
5657
}

packages/shared/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@
4545
"feature",
4646
"flags",
4747
"toggles"
48-
]
48+
],
49+
"sideEffects": false
4950
}

packages/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@
5454
},
5555
"devDependencies": {
5656
"@openfeature/core": "^1.9.2"
57-
}
57+
},
58+
"sideEffects": false
5859
}

0 commit comments

Comments
 (0)