<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AnkitKatheriya</title>
    <description>The latest articles on DEV Community by AnkitKatheriya (@ankitkatheriya).</description>
    <link>https://dev.to/ankitkatheriya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F714171%2F26df76a5-6d44-427f-95de-7f9398b7d56a.png</url>
      <title>DEV Community: AnkitKatheriya</title>
      <link>https://dev.to/ankitkatheriya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankitkatheriya"/>
    <language>en</language>
    <item>
      <title>Using webpack-bundle-analyzer npm package step by step</title>
      <dc:creator>AnkitKatheriya</dc:creator>
      <pubDate>Mon, 27 Sep 2021 10:58:07 +0000</pubDate>
      <link>https://dev.to/ankitkatheriya/using-webpack-bundle-analyzer-npm-package-step-by-step-107d</link>
      <guid>https://dev.to/ankitkatheriya/using-webpack-bundle-analyzer-npm-package-step-by-step-107d</guid>
      <description>&lt;p&gt;Yesterday I came across a requirement to know the bundle size of npm modules, which we needed to analyze the performance improvement of my application. After searching on the web I found a solution to use webpack-bundle-analyzer. But in most of the blogs the steps was not clear to install and use it. &lt;/p&gt;

&lt;p&gt;So, I am going to share the steps I followed to use it.&lt;/p&gt;

&lt;p&gt;Go to the root directory of your project and open the terminal in your IDE(I am using vs code).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 1: Install &lt;strong&gt;webpack-bundle-analyzer&lt;/strong&gt; npm module as a development dependency.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev webpack-bundle-analyzer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After performing the above step webpack-bundle-analyzer npm module will added into your package.json file under devDependencies section.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 2: Now search &lt;code&gt;webpack.config.js&lt;/code&gt; file in your project repo and at the top of this file add below line.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Step 3: After adding above line into webpack.config.js file. Search for the &lt;code&gt;plugins: [&lt;/code&gt; section in this file and add below line.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new BundleAnalyzerPlugin(),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Step 4: Great all steps has been configured to use it. Now run your application using command &lt;code&gt;npm start&lt;/code&gt;. You will see that two tabs will open in your default browser one is your application running url and another one is for webpack bundle analyzer. Url used by the analyzer will be &lt;a href="http://127.0.0.1:8888/"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Done. Simple and fast&lt;br&gt;
Please like this post if you find it useful.&lt;/p&gt;

</description>
      <category>webpack</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
