码迷,mamicode.com
首页 > 编程语言 > 详细

[Poi] Build and Analyze Your JavaScript Bundles with Poi

时间:2018-01-03 22:30:43      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:undle   javascrip   ever   project   min   and   div   return   options   

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

标签:undle   javascrip   ever   project   min   and   div   return   options   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!