Skip to content

Commit 14441b1

Browse files
authored
fix: remove events.js from core module (#650)
Optimization to `@openfeature/core` package. Both server and web need the node-js `Events` interfaces, but obviously only the web needs them poly-filled (they come with node). This PR: - marks `events.js` as an external dep in `@openfeature/core` meaning it won't be bundled there (see esbuild [doc](https://esbuild.github.io/api/#external)) This means that now `@openfeature/core` no longer includes `events.js` (an un-needed polyfill for the server). The bundling pictured below only happens in the `dist/` of `@openfeature/web-sdk`, and no longer in `@openfeature/core` : ![image](https://github.com/open-feature/js-sdk/assets/25272906/2cfdce09-7f00-42a7-b797-9570c816cadb) I've tested both the server and web SDKs based on this change locally in the js-contribs by running the e2e test suite. Relates to: #616 Signed-off-by: Todd Baert <[email protected]>
1 parent e72fc19 commit 14441b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/shared/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"lint": "eslint ./",
2020
"clean": "shx rm -rf ./dist",
2121
"type": "tsc --project ./tsconfig.json --declaration --emitDeclarationOnly",
22-
"build:esm": "esbuild src/index.ts --bundle --sourcemap --target=es2016 --format=esm --outfile=./dist/esm/index.js --analyze",
23-
"build:cjs": "esbuild src/index.ts --bundle --sourcemap --target=es2016 --format=cjs --outfile=./dist/cjs/index.js --analyze",
22+
"build:esm": "esbuild src/index.ts --bundle --external:events --sourcemap --target=es2016 --format=esm --outfile=./dist/esm/index.js --analyze",
23+
"build:cjs": "esbuild src/index.ts --bundle --external:events --sourcemap --target=es2016 --format=cjs --outfile=./dist/cjs/index.js --analyze",
2424
"build:rollup-types": "rollup -c ../../rollup.config.mjs",
2525
"build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:rollup-types",
2626
"postbuild": "shx cp ./../../package.esm.json ./dist/esm/package.json",

0 commit comments

Comments
 (0)