Closed mi2oon closed 4 years ago
@mi2oon that's also a good one 👍 I think we may just make this switch alongside with the transition to the upcoming webpack 5 release.
@racse1 Alright, let's wait for the v5. 👍 However, I've already done some pref on existing projects and didn't see a huge difference 🍷
If some do wishes to test it out, you can simply do that be addeding the following to your webpack.config.js
The package needed should already be in your node_modules folder :)
import TerserPlugin from 'terser-webpack-plugin';
.......
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
extractComments: true
})
],
.......
I've already done some pref on existing projects and didn't see a huge difference 🍷
I think the huge difference comes when you don't compile for IE11. I'm currently working out a way to support separate bundles for IE. Haven't figured the best way yet though, looks a bit messy when you have too much webpack configs 😄
The package needed should already be in you node_modules folder :)
@mi2oon yeah, you're right. They use it by default nowadays (when you use kind of empty config with mode
set to production
).
I think the huge difference comes when you don't compile for IE11. I'm currently working out a way to support separate bundles for IE. Haven't figured the best way yet though, looks a bit messy when you have too much webpack configs
@racse1 Wow, I've been looking into that too and haven't been able to find a good way. But I hope we can get a non messy version. It's a bit sad to see the code getting transpiled to the lowest common denominator. ⚫️
@mi2oon yeah, you're right. They use it by default nowadays (when you use kind of empty config with mode set to production).
@racse1 I didn't know exactly when they where using it. But nice, perhaps we should just switch before v5 as it's not that hard. I can create a PR 🎟
Hey @mi2oon, sorry, completely missed a couple of your last comments.
I've got some updates on IE 11 thing, looks pretty good with webpack-merge. I'll follow up with the details a bit later (perhaps a separate issue).
Regarding Terser, cool, looking forward 😀 I think we can just remove:
And we're good to go 😉
Fixed in #55.
Why choose Terser? uglify-es is no longer maintained and uglify-js does not support ES6+. Also it has potential speed improvements(pref) and webpack team is already using it.
Any thoughts @kraftvaerk/frontend?