Closed aryaemami59 closed 1 month ago
Name | Link |
---|---|
Latest commit | 9fbee6a6e2df44d9c41c5594867808b9c904adfb |
Latest deploy log | https://app.netlify.com/sites/reselect-docs/deploys/66b8d685a5976a0008b323e4 |
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.
Anything else you want to add here? Also, what's the net bundle size changes? (suppose it might help if we merge the size-limit
PR first...)
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 "browser"
field entry, and the removal commit mentions some Webpack 4 incompat, but I don't know more beyond that. Can you clarify what you've found?
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 .mjs
extension and webapck4
doesn't like named imports of CJS libraries in a .mjs
file, and use-sync-external-store
is a CJS library. So I removed the browser field on React-Redux, and I removed it from Reselect's package.json
as well because I was kinda scared it would create unexpected issues. Also Publint complains if you add a top level browser field so that was another reason.
We could add a top level unpkg
field to package.json
and set it to "./dist/reselect.browser.mjs"
as currently the default build artifact consumed by unpkg
is the same as main
which is "./dist/cjs/index.js"
.
We could have separate development
and production
entry points for cjs
as opposed to conditionally re-exporting cjs
artifacts in "./dist/cjs/index.js"
. So the exports
field in our package.json
could look something like this (we could probably get rid of the last "default"
field altogether):
"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"
}
}
},
We could add a "bun"
entry pointing to our "./src/index.ts"
file:
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/reselect.d.mts",
"bun": "./src/index.ts",
"import": "./dist/reselect.mjs",
"default": "./dist/cjs/index.js"
}
},
We could have dual type definitions:
"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:
createSelector
changes (Click to expand)createSelectorCreator
changes (Click to expand)createStructuredSelector
changes (Click to expand)lruMemoize
changes (Click to expand)referenceEqualityCheck
changes (Click to expand)setGlobalDevModeChecks
changes (Click to expand)unstable_autotrackMemoize
changes (Click to expand)weakMapMemoize
changes (Click to expand)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.
Thanks. Can we add esbuild
to devDependencies
instead of the resolutions
field? Do you want me to put up a PR for that?
This PR:
tsup
config to add production and development CJS output files.@__PURE__
annotation to some of the function call sites to improve treeshakeability.WeakRef
to a function calledgetWeakRef
with@__PURE__
annotation to its call site.browser
field inpackage.json
to browser artifact. (Not sure if we want to keep thebrowser
artifact so if not let me know and I can get remove it).