How to solve the problem that app.js is too big in vue-cli3 production environment?

1. There is no route
2. The component has loaded
3 on demand. The code is not compressed, how to compress

Thank you for your advice

Jun.29,2022

  1. install webpack-bundle-analyzer
  2. vue.config.js configure
chainWebpack: (config) => {  //
        config.plugin('webpack-bundle-analyzer')
            .use(BundleAnalyzerPlugin)
            .init(Plugin => new Plugin());
    },



A lot of ways to compress Baidu depend on your own needs


as shown in the figure, components have been loaded on demand, and not many modules have been introduced at all. I don't know why they are so large. Solve


use cdn to optimize vue family buckets. You can check this https://juejin.im/post/5b97b8...


to see if there are any bulky components introduced. Consider alternative optimization. If vue-cli3, you can open a visual interface to analyze dependencies

.
Menu