首页 > 编程语言 > 详细

[Poi] Build and Analyze Your JavaScript Bundles with Poi

时间:2018-01-03 21:59:02      阅读:219      评论:0      收藏:0      [点我收藏+]

Ever wonder where those extra KB in your bundle are coming from? This lesson walks you through running Poi‘s build process. Then we‘ll add a bundle analyzer to find where you may be able to trim down on your file size.

 

Install:

npm i -D webpack-bundle-analyzer

 

Build project:

poi build

 

poi.config.js:

const BundleAnalyzer = require(‘webpack-bundle-analyzer‘).BundleAnalyzerPlugin;

module.exports = (options) => ({
    webpack(config) {
       

        if(options.analyze) {
             config.plugins.push(
                new BundleAnalyzer()
             )
         }


        return config;
    }       
})

 

Run with analyzer:

poi build --analyze

 

[Poi] Build and Analyze Your JavaScript Bundles with Poi

原文:https://www.cnblogs.com/Answer1215/p/8185711.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!