-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Switch build tooling to tsup
and modernize JS build artifacts
#1032
Conversation
Nice, thanks for this @markerikson ! 🙌
Wonder if this PR discussion between @andrewbranch and @Andarist helps at all to try to resolve this error, it is also mentioning |
Awesome, thanks so much for introducing tsup, this looks so much better! Just merged the changes, with one minor change; I changed the Interestingly enough, after gzip etc the difference is especially reducing the MapSet plugin :) 46cd1d5#diff-9eca5a1e442f863695367206f19cbb2b6c0aab0da2211ba0f6b9194c2fcfdb12 Anyway, thanks so much for this PR! |
Ah, just noticing that the internal fields aren't minified yet, so the build can be a bit smaller still. 12941 -> 11498 :) |
Awesome, glad this worked out! Let me know when you've got a new beta published! |
@mweststrate except that I just tried looking at the sourcemaps and they seem very badly busted :( Scratch that idea. minify: minify ? 'terser' : false,
terserOptions: minify
// usual Terser options here
? {
output: {
comments: false,
},
compress: {
keep_infinity: true,
pure_getters: true,
passes: 10,
},
ecma: 2020,
toplevel: true,
}
: undefined, |
I noticed that ESBuild also supports mangling props, do you know if terser
minifies better? Otherwise the simplicity of having a build tool less is
appealing, although terser never gave any issue so far
…On Sun, Apr 16, 2023 at 4:54 AM Mark Erikson ***@***.***> wrote:
@mweststrate <https://github.com/mweststrate> One more possible trick I
found. Turns out tsup supports using Terser for minification instead of
ESBuild. I'm in the process of switching RTK over to use tsup, and here's
how you configure it:
minify: minify ? 'terser' : false,
terserOptions: minify
// usual Terser options here
? {
output: {
comments: false,
},
compress: {
keep_infinity: true,
pure_getters: true,
passes: 10,
},
ecma: 2020,
toplevel: true,
}
: undefined,
—
Reply to this email directly, view it on GitHub
<#1032 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBFZABQAV2N2VICLM3TXBNNNLANCNFSM6AAAAAAWZDLUH4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mweststrate : Terser is a bit better at minifying than ESBuild. That said, I just tried copy-pasting your previous Terser settings over, and it was only like 50 bytes smaller and the sourcemaps were borked. So, sticking with ESBuild is probably the best option here. |
🎉 This PR is included in version 10.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR builds on top of the Immer 10 work in #1028 :
tsdx
totsup
__DEV__
flags withprocess.env.NODE_ENV
checks"FalseCJS"
warning fromarethetypeswrong
, which I'm ignoring for now"module"
key, by using a.js
extension and targeting ES2017 syntax (transpiling optional chaining and object spreads)Object.getPrototypeOf
to a variable for better minificationThis shaves a few KB off the size of a production build. For the minified CJS Prod artifact:
The minified production
.mjs
artifact is even smaller, at 12941b