webpack packaged commit code

① Project Releases
npm run build
Or npm run build - report
Will open the browser analytical view showing a package directory (that is, large or small file)
In the build undex.js under confug in the last row
 
GZip compression turned on
But after compression or large volume can be turned GZip compression (Apache, IIS, Tomcat, Node server) as a web server
if you do not enable GZip compression, then the real size of the file on the server ,, is the network transmission, the transmission of real size
If a quarter of server, enable GZip compression, the file in the network, the transmission time will be compressed, after Gzip compression, and file size will be reduced to about previous
 
Add a module to the file in the build in webpack.prod.conf.js, output flat levels externals: {},

externals meaning the item, some relatively large size of the package, detached manner external load's (link The way)
  // the item, some relatively large size of the package, is pulled out externally loaded embodiment 
  externals: { 
    // package name: 'constructor' 
    VUE: 'Vue', // VUE 
    'VUE-Router': 'VueRouter' // route 
    Axios: 'Axios', 
    lodash: '_', 
    nProgress: 'nProgress', 
    echarts: 'echarts' 
  },

 

npm i compression -S
in

Guess you like

Origin www.cnblogs.com/maxiag/p/11785335.html