Repository navigation
Improve treeshakeability of build artifacts - #721
Conversation
✅ Deploy Preview for reselect-docs canceled.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
- It seems like `webpack4` prefers the `browser` field over the `module` field, and the current build artifact seems to be incompatible with it so we are going to remove it for now.
|
Anything else you want to add here? Also, what's the net bundle size changes? (suppose it might help if we merge the |
|
Yeah let's do the size limit one first. Do you want me to get rid of the browser artifact? |
|
I think I'm missing some context here. I see that you added and removed a |
|
The CI example app for cra4 failed when I added it. Edit: The cra4 example app failed for React-Redux when I added it, it failed because it has a |
- `env` is the same thing as `define` with `JSON.stringify`.
- Currently there is no difference between emitting type definitions with `cjs` or `esm` format, the only difference is the file extension. So we emit the type definitions with a `cjs` format to preserve the previous `.d.ts` extension as opposed to the new `.d.mts` extension.
- Currently there is no difference between emitting type definitions with `cjs` or `esm` format, the only difference is the file extension. So we emit the type definitions with a `cjs` format to preserve the previous `.d.ts` extension as opposed to the new `.d.mts` extension.
133c303 to
1520b44
Compare
Other changes to consider adding:
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/reselect.d.ts",
"import": "./dist/reselect.mjs",
"default": {
"development": "./dist/cjs/reselect.development.cjs",
"production": "./dist/cjs/reselect.production.min.cjs",
"default": "./dist/cjs/index.js"
}
}
},
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/reselect.d.mts",
"bun": "./src/index.ts",
"import": "./dist/reselect.mjs",
"default": "./dist/cjs/index.js"
}
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/reselect.d.mts",
"default": "./dist/reselect.mjs"
},
"default": {
"types": "./dist/cjs/reselect.d.ts",
"default": "./dist/cjs/index.js"
}
}
},Or maybe even: "exports": {
"./package.json": "./package.json",
".": {
"types": {
"import": "./dist/reselect.d.mts",
"default": "./dist/reselect.d.ts"
},
"import": "./dist/reselect.mjs",
"default": "./dist/cjs/index.js"
}
}, |
|
Can you summarize for me:
|
SummaryWith Rollup
|
|
Nice, that does seem like it's better! |
|
@markerikson I'll try to put togther the same kind of chart for the other Redux repos as well. It might be good to have it as a point of reference. |
d3720d7 to
db19d38
Compare
|
Thanks. Can we add |
This PR:
tsupconfig to add production and development CJS output files.@__PURE__annotation to some of the function call sites to improve treeshakeability.WeakRefto a function calledgetWeakRefwith@__PURE__annotation to its call site.browserfield inpackage.jsonto browser artifact. (Not sure if we want to keep thebrowserartifact so if not let me know and I can get remove it).