Skip to content

Commit e092f81

Browse files
authored
chore: Ship unminified file as ESM entrypoint (#752)
## Background This PR is copied from [484](#484). It was contributed by @jasonkarns a couple of years ago. I just pulled his changes, merged master and resolved conflicts. ## Summary ESM entrypoints are very very likely to be consumed by bundlers, not loaded directly into browsers. Therefore it is preferable that the bundlers have access to the unminified source so that consumers can have more control over the final output. ~~This change _adds_ an ESM output bundle that is not minified with terser.~~ (#477 has merged which also adds the unminified ES bundle, so this PR now just makes the unminified bundle the `module` entrypoint.) Notably, the unminified bundle is created _in addition to_ the minified bundle; so the minified bundle is still distributed with the package (at the same output location). This way users who do actually want the minified bundle may still use it. However, the `package.json#module` entrypoint is changed to reference the unminified bundle, as this is most likely what users will want when consuming from a bundler. (And bundlers are virtually the exclusive consumers of the `module` entrypoint.)
1 parent 5e8d539 commit e092f81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@optimizely/optimizely-sdk",
33
"version": "4.9.1",
44
"description": "JavaScript SDK for Optimizely X Full Stack",
5-
"module": "dist/optimizely.browser.es.min.js",
5+
"module": "dist/optimizely.browser.es.js",
66
"main": "dist/optimizely.node.min.js",
77
"browser": "dist/optimizely.browser.min.js",
88
"react-native": "dist/optimizely.react_native.min.js",

0 commit comments

Comments
 (0)