Why is the file packaged by vue-cli webpack so large?

I use vue-router to load lazily. Why are some of the packaged files so large? for example, this 2 contains other js? in 2.js * . How to divide them

the above is analyzed by webpack-bundle-analyzer. Please take a look at it for me


use the tool webpack-bundle-analyzer to analyze the dependencies to see if those modules are referenced to cause oversize. Then targeted Code Splitting. The problem I encountered earlier, for example, is that a large number of component library modules are repeatedly referenced in the demand-loaded page. Please refer to my article: https://saekiraku.github.io/a.


see how your webpack configuration item devtool matches


if you can use cdn, use cdn instead of, element, vue, etc.
add cdn, to index.html
configure it in webpack.base.conf.js

 externals: {
    vue: 'Vue',
    'element': 'element-ui'
  },


as long as you re-package the common code into the component


I happen to have used xlsx.js , so I'll talk about it.

this library is not meant to be loaded at page initialization, so its can be detached so that the package size will be much smaller.

xlsx.js file is very large!

as to how to take it out, there are two ways :

  1. use webpack external
  2. use window.xlsx directly in your code (make sure the code has been loaded when you use it)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35a69-2acf5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35a69-2acf5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?