-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Breaking changes to outputs & pkg.json #4652
Conversation
…, & use `.mjs` exclusively
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Resultscreate10kduration
usedJSHeapSize
filter-listduration
usedJSHeapSize
hydrate1kduration
usedJSHeapSize
many-updatesduration
usedJSHeapSize
replace1kduration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
text-updateduration
usedJSHeapSize
tododuration
usedJSHeapSize
update10th1kduration
usedJSHeapSize
|
Size Change: -29.6 kB (-38.72%) 🎉 Total Size: 46.8 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sounds reasonable to me. I'm kinda wondering if it's worth it to move to type: "module"
at some point or if that would be too much of a breaking change.
Not sure why coveralls is breaking, weird. I don't think we'd gain much from |
fair point! |
18935a3
to
ad213f4
Compare
a33b56f
to
133776c
Compare
* refactor: Switch to `package.json#exports.module`, drop `.min` builds, & use `.mjs` exclusively * chore: Remove leftover CJS shell * test: Fix export for karma * fix: coverage not generated in minify tests --------- Co-authored-by: Marvin Hagemeister <[email protected]>
* refactor: Switch to `package.json#exports.module`, drop `.min` builds, & use `.mjs` exclusively * chore: Remove leftover CJS shell * test: Fix export for karma * fix: coverage not generated in minify tests --------- Co-authored-by: Marvin Hagemeister <[email protected]>
Lands a few breaking changes at once, happy to revert any part or all of this if we feel anything's a problem.
.module.js
for.mjs
Obviously this is where the ecosystem is going and it already has pretty good support: Webpack started to adopt back in late 2018 and Node has supported it since v12.16 onward. This moves our effective back compat date up to about 5-6 years ago.
Perhaps too soon, but thought I'd at least suggest it.
package.json#exports.browser
topackage.json#exports.module
This comes up fairly often, usually due to test runners trying to load modules meant for the browser in Node and then crashing as our browser build does not adhere to Node's ESM semantics. See #4406, preactjs/jest-preset-preact#13 (comment), #3634. While I'd tend to call that ecosystem error, it's not going away any time soon and we don't even use this output; it's just a standard ESM build, nothing browser-specific.
Instead of dropping this entirely though we can switch to
module
which some bundlers use to guarantee the package isn't instantiated twice (Webpack's docs on the subject). We had this change in the v11 branch and I think it's good to carry over. Might also reduce some of the__H
reports we have to deal with..min
buildsThese largely appear to be broken as-is (
preact.min.module.js
is not ESM, there's no CJS build as the IIFE output overwrites it immediately,preact.min.umd.js
doesn't appear to be valid UMD either); the only thing maybe of value is the IIFE outputpreact.min.js
. It's 30b lighter thanpreact.umd.js
, but I don't know who's actually using it (if anyone at all).Users are almost certainly better off with the plain UMD build and we'd be better off dropping it to reduce some confusion as it's unclear when this is meant to be used.