Webpack Minification Optimization

2

I'm starting with Webpack and I'm learning how to tweak Config of it, and I saw some of the documentation dealing with Resolve.extentions , you can hide the extensions. But it came to my mind: In my imports I put for example:

import 'jquery/dist/jquery.min.js'

In this case now I only put:

import 'jquery/dist/jquery'

And it works fine. Beauty. But it is catching .js , not the mined file. Does it make any difference in terms of performance to get .js or .min.js ? How does Webpack handle this type of file? Do you have to put some Priority for it to get the .min.js first?

    
asked by anonymous 19.10.2017 / 18:32

1 answer

1
  

It makes some difference in terms of performance it takes the .js or   .min.js?

Yes, it makes a lot of difference. The minified file, as its name says, is smaller, and this generates performance difference when the site loads the dependencies because a smaller file is loaded and interpreted faster.

  

Do you have to put some Priority to get the .min.js first?

You can put in the configuration of resolve.extensions , something similar to:

resolve: {
  extensions: ['.min.js', '.js']
}
    
19.10.2017 / 19:31