Skip to content
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

Move to Terser from UglifyJS #51

Closed
mi2oon opened this issue Jan 8, 2019 · 6 comments
Closed

Move to Terser from UglifyJS #51

mi2oon opened this issue Jan 8, 2019 · 6 comments

Comments

@mi2oon
Copy link
Member

mi2oon commented Jan 8, 2019

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?

@kristoforsalmin
Copy link

kristoforsalmin commented Apr 4, 2019

@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.

@mi2oon
Copy link
Member Author

mi2oon commented Apr 4, 2019

@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
            })
        ],
.......
```

@kristoforsalmin
Copy link

kristoforsalmin commented Apr 4, 2019

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).

@mi2oon
Copy link
Member Author

mi2oon commented Apr 5, 2019

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 🎟

@kristoforsalmin
Copy link

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:

https://github.com/kraftvaerk/generator-rammevaerk/blob/master/app/templates/_webpack.config.js#L41-L46

And we're good to go 😉

@kristoforsalmin kristoforsalmin added this to the v4 milestone Oct 10, 2019
@kristoforsalmin
Copy link

Fixed in #55.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants