<?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>Forem: Suraj Narsale</title>
    <description>The latest articles on Forem by Suraj Narsale (@surajnarsale).</description>
    <link>https://forem.com/surajnarsale</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%2F552598%2F3cedde7b-b6e0-4b24-b6ee-94e202d05c78.png</url>
      <title>Forem: Suraj Narsale</title>
      <link>https://forem.com/surajnarsale</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/surajnarsale"/>
    <language>en</language>
    <item>
      <title>Why to Learn WEBPACK before diving into REACT?</title>
      <dc:creator>Suraj Narsale</dc:creator>
      <pubDate>Fri, 25 Jun 2021 08:57:59 +0000</pubDate>
      <link>https://forem.com/surajnarsale/learn-webpack-before-diving-into-react-4lk3</link>
      <guid>https://forem.com/surajnarsale/learn-webpack-before-diving-into-react-4lk3</guid>
      <description>&lt;h2&gt;
  
  
  🌐How browser runs JavaScript
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;   The browser contains a 🔥JavaScript engine that can be pointed as the 🎯brain of the browser.&lt;/li&gt;
&lt;li&gt;  Without JavaScript, the browser engine would not be able to read JavaScript files.&lt;/li&gt;
&lt;li&gt; So if your HTML file contains many script files, probably engine would load your files in the order which you don’t want.&lt;/li&gt;
&lt;li&gt;If you aren't dynamically loading scripts or marking them as defer or async, then scripts are loaded in the order encountered in the page. It doesn't matter whether it's an external script or an inline script - they are executed in the order they are encountered in the page.&lt;/li&gt;
&lt;li&gt;To setup the order of scripts would be the restless activity?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;To solve this problem&lt;/em&gt; 👋&lt;strong&gt;WEBPACK&lt;/strong&gt; &lt;em&gt;can come in handy.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ What is WEBPACK?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  If you are into building moderns JavaScript apps, probably you would have come across the term &lt;strong&gt;webpack&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Webpack is a &lt;strong&gt;module bundler&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It bundles all your JavaScript files and produces a single JavaScript  file, mostly called as &lt;strong&gt;production build file&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Why to use WEBPACK?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; So you don’t want to manage the order of dependencies.&lt;/li&gt;
&lt;li&gt;It converts all your JavaScript files into one big JavaScript file.&lt;/li&gt;
&lt;li&gt; It also converts all your CSS files into one single CSS file.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  ✅ How  WEBPACK works🎰?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; It observes your import-export statements and builds a &lt;strong&gt;DEPENDENCY GRAPH&lt;/strong&gt;. Then it generates one or more bundles and pushes them into the production build folder

&lt;ol&gt;
&lt;li&gt;Webpack also takes your assets and converts them to dependencies.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;h2&gt;
  
  
  ✅  Principals on which WEBPACK works
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;You don't need to understand these below concepts. We will see these in practice in the next section. They are here to just give you an overview.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;PRINCIPALS&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Entry&lt;/td&gt;
&lt;td&gt;Entry is the entry point for the application. It is the first module (JavaScript file)that Webpack will process to build out the full dependency graph&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Output&lt;/td&gt;
&lt;td&gt;Output point is where the files are to be written on disk with the name of the files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Loaders&lt;/td&gt;
&lt;td&gt;Loaders can transform files from a different language (like TypeScript) to JavaScript or load inline images as data URLs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Plugins&lt;/td&gt;
&lt;td&gt;Plugins handle the additional tasks that can’t be completed by a loader.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Mode&lt;/td&gt;
&lt;td&gt;Mode tells  Webpack which configuration and optimizations to use for your application.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  ✅ Let's get to the  playground
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;must have node installed.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  👍 Dependencies
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;npm init -y&lt;/code&gt; : (Initialize node project)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm i wepack webpack-cli --save-dev&lt;/code&gt; : (They are installed as dev dependency cause they just become Single Page Application at the end during production.)&lt;/li&gt;
&lt;li&gt; &lt;code&gt;npm i svg-inline-loader --save-dev&lt;/code&gt;: (Just a random SVG dependency for our practice.) JavaScript is not able to load SVG files directly, so we are going to use the svg-inline-loader module.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;npm i --save-dev css-loader&lt;/code&gt;: (css loader used to load css in html file)&lt;/li&gt;
&lt;li&gt; &lt;code&gt;npm i --save-dev babel-loader&lt;/code&gt;:(so that we can use modern JavaScript)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm i --save-dev html-webpack-plugin&lt;/code&gt;:(it injects your output code into html)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm i --save-dev webpack-dev-server&lt;/code&gt;:(dev server which fast reloads when you save your file.)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  👍&lt;code&gt;webpack.config.js&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create file  &lt;code&gt;webpack.config.js&lt;/code&gt; in the root folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Add following code in it&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HtmlWebpackPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html-webpack-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app/index.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;svg$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svg-inline-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;css$/i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;style-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.(&lt;/span&gt;&lt;span class="sr"&gt;js&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;babel-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dist&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bundle.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
     &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HtmlWebpackPlugin&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
     &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NODE_ENV&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;webpack.config.js&lt;/code&gt; Explained
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;entry&lt;/code&gt;: 
-- In the above code, we defined entry point to our codebase ie. &lt;code&gt;entry: "./src/index.js",&lt;/code&gt;JavaScript engine would start to read code from this file.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;modules&lt;/code&gt;: &lt;/li&gt;
&lt;li&gt;We also defined some loaders like  &lt;code&gt;svg-inline-loader&lt;/code&gt;  &amp;amp;  &lt;code&gt;css-loader&lt;/code&gt;
  --css-loader uses &lt;code&gt;style-loader&lt;/code&gt; under the hood.
          &lt;code&gt;rules&lt;/code&gt; defines some rules
      &lt;code&gt;test&lt;/code&gt; search files with given extention
      &lt;code&gt;use&lt;/code&gt; when files with given extention is found use particular loader&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;output&lt;/code&gt;:&lt;/li&gt;
&lt;li&gt; It defines the path of the output file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugins&lt;/code&gt;:
    - &lt;code&gt;html-webpack-plugin&lt;/code&gt; : It  generates&lt;code&gt;index.html&lt;/code&gt; file &amp;amp; takes output file from above and injects it into &lt;code&gt;index.html&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mode&lt;/code&gt;:
    - It says whether code should be in &lt;strong&gt;production mode&lt;/strong&gt; or &lt;strong&gt;development mode&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  👍&lt;code&gt;package.json&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Add these two scripts in package.json&lt;/em&gt;&lt;br&gt;
✔️ For macOS users&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;webpack serve&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NODE_ENV='production' webpack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️For Window users&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;webpack serve&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SET NODE_ENV='production' &amp;amp; webpack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;"start":"webpack"&lt;/code&gt;: It seraches in node_modules for webpack&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"build":"SET NODE_ENV='production' &amp;amp; webpack"&lt;/code&gt; : It creates dist folder which can be used for production.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  👍&lt;code&gt;index.js&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;create &lt;code&gt;app/index.js&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Add following code in it&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Monday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Tuesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Wednesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Thursday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Friday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Saturday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ✅ Conclusion
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;If you run the &lt;code&gt;start&lt;/code&gt; script you can see our app running in the browser.&lt;/li&gt;
&lt;li&gt;If you run the &lt;code&gt;build&lt;/code&gt; script you can see webpack creates dist folder which is our production build.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally, we can see the JS file running in the browser is nothing but the bundle.js.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9zh03umtnw5s0vf3ij2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9zh03umtnw5s0vf3ij2.png" alt="Browser file" width="477" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webpack</category>
      <category>javascipt</category>
      <category>modulebundler</category>
    </item>
  </channel>
</rss>
