When your code is ready for production, you can run the uglify-js-webpack-plugin to minify the code. Learn how minification and uglification trims variable names and places all of the code on one line.
- [Instruction] Another very useful plug that we can use…is the UglifyJS webpack plug in.…What this is going to do is it's going to minify all of our code…and it's going to generate a bundle…that should be in one line.…Now the first thing I want to do here is…go to my IndexJS file and we're going to just delete everything…and replace it with a simple function.…So I'm going to say const add = (x, y)…and then this should return x + y.…
There we go.…So this is our only thing we have going on here…but we're still going to want to minify it,…in a minute.…Now the next thing I want to do is install this package…so we'll say uglifyjs-webpack-plugin-save-dev.…And once that is installed…we will be able to make use of that.…While that process is in the background lets go ahead and…make some adjustments to our webpack config file.…So several things are going to change here.…
The first thing that'll change is UglifyJSPlugin…is going to be imported rather than html-webpack-plugin.…The next thing we want to change here is our entry point.…
- What is webpack?
- Running webpack from the command line
- Setting up loaders
- Loading CSS
- Compiling SCSS
- Using webpack plugins
Skill Level Intermediate
1. What is webpack?
2. webpack Loaders
3. webpack and CSS
4. webpack Plugins
Next steps1m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.