zoukankan      html  css  js  c++  java
  • [Webpack] Analyze a Production JavaScript Bundle with webpack-bundle-analyzer

    Bundle size has a huge impact on JavaScript performance. It's not just about download speed, but all the JavaScript we ship to the browser needs to be parsed and compiled before it can be executed. Keeping our bundle in check can be difficult, but it's much easier when we can see where the bloat is coming from. In this lesson

    Install:

    npm i -D webpack-bundle-analyzer

    We want to do anaylyzer only for production:

    // webpack.config.prod.js
    
    const merge = require('webpack-merge')
    const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
    const baseConfig = require('./webpack.config.base')
    
    module.exports = merge(baseConfig, {
      mode: 'production',
      plugins: [new BundleAnalyzerPlugin({
        analyzerMode: 'static',
        openAnalyzer: false,
        reportFilename: 'bundle_sizes.html'
      })]

    it generate a 'bundle_szies.html' file in dist folder.

    Github

  • 相关阅读:
    Redis基础
    MySQL基础
    MySQL基础
    MySQL基础
    MySQL基础
    Hello 博客园
    Linux | 常用命令
    JVM | 性能调优
    JVM | 垃圾回收
    学习笔记 | 分布式技术
  • 原文地址:https://www.cnblogs.com/Answer1215/p/10554664.html
Copyright © 2011-2022 走看看