<?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: Sailesh Subramanian</title>
    <description>The latest articles on DEV Community by Sailesh Subramanian (@saileshsubramanian).</description>
    <link>https://dev.to/saileshsubramanian</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%2F354920%2Fd789c5a4-d21b-4e25-bba4-4eb538510b93.jpg</url>
      <title>DEV Community: Sailesh Subramanian</title>
      <link>https://dev.to/saileshsubramanian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saileshsubramanian"/>
    <language>en</language>
    <item>
      <title>My Thoughts on Decoupled Drupal with GatsbyJS |Part 1</title>
      <dc:creator>Sailesh Subramanian</dc:creator>
      <pubDate>Mon, 04 May 2020 07:19:05 +0000</pubDate>
      <link>https://dev.to/saileshsubramanian/my-thoughts-on-decoupled-drupal-with-gatsbyjs-part-1-366i</link>
      <guid>https://dev.to/saileshsubramanian/my-thoughts-on-decoupled-drupal-with-gatsbyjs-part-1-366i</guid>
      <description>&lt;p&gt;The past decade saw an outburst of smart devices and widely opened different channels of interaction. The front end technologies grew by leaps and bounds. GatsbyJs is a popular open-source static site generator, bundled with React, GraphQL, Webpack, to create blazingly fast websites. Let’s see how we can combine it with a popular CMS, Drupal 8.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monolithic vs Decoupled&lt;/strong&gt;&lt;br&gt;
The typical CMS has the backend and the frontend coupled, which is monolithic. This system helped to manage and deliver the content to a huge user base. But that was years ago. The coupled system is now a hindrance as the business has to serve the varied devices and channels, adopt new front end frameworks that could give high performing websites.&lt;br&gt;
Drupal has proved itself to be versatile CMS with its powerful content types and WYSIWYG editor. In the decoupled systems the presentation layer is being handled by the Javascript layer, in our case GatsbyJS. Drupal 8 serves as the content modeling, creation, and management backend with data being served in the form of API.&lt;br&gt;
&lt;em&gt;JAMStack systems leverage the capacity of big players Javascript, APIs, and Markups. JAMstack site with Drupal serving as a backend or headless CMS is the core of decoupled architecture.&lt;/em&gt;&lt;br&gt;
GatsbyJS serves in the front end with the powerful GraphQL to fetch data from the Drupal backend. GatsbyJS internally uses a React code base that makes it easy for the front end developers.&lt;br&gt;
A decoupled Drupal architecture offers two key advantages over a tightly coupled one.&lt;br&gt;
&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;You can use one content management system to serve multiple frontends — for example, your Gatsby site, your mobile application, and your smart TV application.&lt;/li&gt;

&lt;li&gt;You can develop, change, and upgrade the frontend and backend independently of each other. Upgrading Drupal doesn’t require you to modify your site’s appearance. More on decoupled architecture with Gatsby in &lt;a href="https://www.gatsbyjs.org/docs/glossary/decoupled-drupal/"&gt;here&lt;/a&gt;
&lt;/li&gt;

&lt;p&gt;&lt;strong&gt;Let’s dive in with a short hands on&lt;/strong&gt;&lt;br&gt;
I have set up Drupal in my system using the &lt;code&gt;Acquia dev desktop 2&lt;/code&gt;&lt;br&gt;
I have created a basic page and some articles. Make sure you have &lt;code&gt;JSON: API&lt;/code&gt;module enabled. This serves the JSON APIs required for the front end.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R9c9Jc4C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/contentTypes.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R9c9Jc4C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/contentTypes.PNG" alt="Content Types"&gt;&lt;/a&gt;&lt;/p&gt;
Sample articles and pages created



&lt;p&gt;To check the &lt;code&gt;JSON: API&lt;/code&gt; is enabled and the JSON responses are serving properly test the APIs with any clients such as postman or any other rest clients. Hit the URL &lt;code&gt;http://localhost:&amp;lt;port&amp;gt;/jsonapi/node/article&lt;/code&gt; and you will the response JSON as below&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ny0OG6IL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/restCLient.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ny0OG6IL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/restCLient.PNG" alt="Content Types"&gt;&lt;/a&gt;&lt;/p&gt;
Rest client check



&lt;p&gt;&lt;strong&gt;Gatsby Setup&lt;/strong&gt;&lt;br&gt;
Install the Gatsby CLI globally using &lt;code&gt;npm install -g gatsby-cli&lt;/code&gt;.&lt;br&gt;
Create a new Gatsby site using &lt;code&gt;gatsby new gatsby-site&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Move to the site folder which in our case is gatsby-site. Then go for gatsby develop. You will see the site running locally at &lt;code&gt;http://localhost:8000&lt;/code&gt;&lt;br&gt;
The initial setup of the gatsby is done. As I mentioned before, we are going to use GraphQL for fetching data instead of a typical https request. It helps to fetch multiple resources in a single fetch, unlike https requests. GraphQL is available with the Gatsby package, so you don’t have to look out further GraphQL installation. Moreover, Gatsby provides us with a playground to try out our GraphQL queries at &lt;code&gt;http://localhost:8000/__graphql&lt;/code&gt;. To connect our Drupal site with our gatsby site, open the gatsby-config.js in the root folder. Change the base URL as below&lt;br&gt;
&lt;/p&gt;

&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
      resolve: `gatsby-source-drupal`,
      options: {
           baseUrl: `http://localhost:&amp;lt;port of drupal site&amp;gt;/`,
      },
}
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Let’s show the articles in our first page.&lt;br&gt;
Import GraphQL and UseStaticQuery from gatsby &lt;code&gt;import { useStaticQuery, graphql } from “gatsby”&lt;/code&gt; .&lt;br&gt;
The GraphQL playground looks like below. You can parse the response JSON and bind it to HTML. Sounds simple. No actually. It took some time to correctly query the required fields for all the articles with the corresponding image. You might need some experience in getting query right as the complexity of the components increases.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bB82jo_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/graphQL.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bB82jo_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/graphQL.PNG" alt="Content Types"&gt;&lt;/a&gt;&lt;/p&gt;
GraphQL query



&lt;p&gt;When you have the data available, you can easily bind it to your react components and show the data in the site.&lt;/p&gt;

&lt;p&gt;Now let’s get going with the page we created in Drupal.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RYb0GAMp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/page.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RYb0GAMp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/SaileshSubramanian/GatsbyJS-Article/master/page.PNG" alt="Content Types"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below you will find the query to fetch the content of the page.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  allNodePage(filter: {title: {eq: "About US"}}) {
    totalCount
    nodes {
      body {
        value
      }
      relationships {
        field_text_with_image {
          field_text_long {
            value
          }
          relationships {
            field_image {
              localFile {
                url
              }
            }
          }
        }
      }
      title
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Like before, bind the corresponding data to our react code to display the data in the about us page. An experienced person can refine the above queries further to get the data required. The main highlight of using the GraphQL instead of rest API is that you can fetch multiple resources using a single query, which in case of rest API you may have to make 2 or 3 GET requests.&lt;/p&gt;

&lt;p&gt;Please do let me know if the article helped you. Happy coding.&lt;br&gt;
Cheers !!&lt;/p&gt;



</description>
      <category>drupal</category>
      <category>decoupledarchitecture</category>
      <category>gatsby</category>
    </item>
    <item>
      <title>CSS Variables</title>
      <dc:creator>Sailesh Subramanian</dc:creator>
      <pubDate>Sat, 02 May 2020 07:00:59 +0000</pubDate>
      <link>https://dev.to/saileshsubramanian/css-variables-4obl</link>
      <guid>https://dev.to/saileshsubramanian/css-variables-4obl</guid>
      <description>&lt;p&gt;I learned about the CSS preprocessors 6 years back. Sass took my breath away with its awesome features, my favorite being nesting and variables. CSS preprocessor variables took away the headache of changing the theme of your web application in one go. You change the variables declared and abracadabra the whole application is painted with a different color theme. With the web world evolving we have now CSS custom properties or CSS variables.&lt;br&gt;
The sad part of CSS preprocessor variables is that the browser does not recognize these static variables, yes they cannot be changed at runtime. It has to be compiled to normal CSS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$font-color: #1a0dab;
..........
p{
color: $font-color
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The above code written in sass will be compiled to as below , so that browsers can understand.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p{
  color:#1a0dab;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Though CSS variables itself is not a replacement for any CSS preprocessors, combining both could make our code sleek and DRY. You could create a CSS variable as below, beginning with two dashes (root being the global scope). However variable names cannot be a property name, say ‘padding-left’, this would end up in error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root{
 --text-color: #e60404;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The scope of changing CSS variables at runtime helps a lot in the dynamic theming of your web/hybrid applications. It also has a deeper impact on Responsive Web Design.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick demonstration
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root{
  --text-color: #e60404;
 }
 label{
   color: var( --text-color);
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;--text-color is the developer defined custom property assigned with #e60404 as value. The var() function pulls the custom property written anywhere in your stylesheets and replaces it with corresponding value.&lt;br&gt;
What if the CSS rules are not respected? Say I put the –-text-color as 30px; . For the element label, color value as 30px does not make any sense. In most cases, it will look for the parent element property or it will then switch to the default value which is black.&lt;/p&gt;
&lt;h2&gt;
  
  
  Cascading
&lt;/h2&gt;

&lt;p&gt;The normal CSS cascading rules are valid in case of CSS variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root{-- text-color: black;}
p{-- text -color: green;}
p.highlight{-- text -color: red;}
*{color: var( --text-color);}
............................
&amp;lt;div&amp;gt; Hi ! My text color is black&amp;lt;/div&amp;gt;
&amp;lt;p&amp;gt; Hi ! My text color is green&amp;lt;/p&amp;gt;
&amp;lt;p class=”highlight”&amp;gt; Hi ! My text color is red&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  The var()
&lt;/h2&gt;

&lt;p&gt;The exact syntax of var() looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var(&amp;lt;custom-property-name&amp;gt; [, &amp;lt;declaration-value&amp;gt; ]? )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;custom-property-name is the developer defined property and the declaration value being the fallback value if the custom-property-name (it’s value) is invalid.&lt;br&gt;
Let’s say we have&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container{
     background-color: var(--bg-color, blue);
     border-radius: var(--brdr-radius, 5px); 
}
body{
     -- bg-color: #f1f3f4;
}
// container will have border radius 5px as default value, since the --brdr-radius is not set
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I got the opportunity to familiarize myself with CSS variables one year back when we are working on an Ionic 4 project. Guess what, we saw the ultimate usage of CSS variables in the web components used in Ionic 4. The idea of web component theming was made effortlessly with CSS variables.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A Web Component author can create an initial design using fallback values, and expose theming “hooks” in the form of custom properties.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Typically I can change the web component custom properties to create my own themes for the components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting the custom properties in run time
&lt;/h2&gt;

&lt;p&gt;The setProperty() allows us to manipulate the custom properties in runtime.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root{
    -- text-color: red
}
p{
  color: var(--text-color);
}
// inside the javascript
element.style.setProperty('--text-color', ‘blue’);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Browser support
&lt;/h2&gt;

&lt;p&gt;Latest versions of all modern web browsers support CSS variables.&lt;br&gt;
Google chrome 😄&lt;br&gt;
Safari 😄&lt;br&gt;
Microsoft Edge 😄&lt;br&gt;
Firefox 😄&lt;br&gt;
IE 11 😢&lt;/p&gt;

&lt;p&gt;Happy coding , enjoy quarantine !!&lt;/p&gt;

</description>
      <category>css</category>
      <category>variables</category>
    </item>
    <item>
      <title>Webpack 4 : Quick Start Guide</title>
      <dc:creator>Sailesh Subramanian</dc:creator>
      <pubDate>Fri, 27 Mar 2020 06:59:37 +0000</pubDate>
      <link>https://dev.to/saileshsubramanian/webpack-4-quick-start-guide-54n4</link>
      <guid>https://dev.to/saileshsubramanian/webpack-4-quick-start-guide-54n4</guid>
      <description>&lt;p&gt;Webpack is one of most commonly used module bundlers available now. It eases the developer's job and provides blazing fast performance coupled with amazing features. From the days of task runners like Grunt and Gulp to Module Bundlers , front-end application development has never been so easier and engaging as today.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;"Webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph which maps every module your project needs and generates one or more bundles"&lt;/i&gt;&lt;br&gt;
&lt;a href="https://webpack.js.org/concepts/"&gt;Read the core concepts from here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Please note that the sole purpose of this article is to help to quickly build a neat webpack build configuration for a webapps. If you are more interested in learning the basics/core concepts of webpack please refer the above mentioned link to get to know about core concepts of webpack. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Let's Dive in&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a directory
&lt;pre&gt;mkdir webpack101 &amp;amp;&amp;amp; cd webpack101&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Use NPM or Yarn for package management
&lt;pre&gt;npm init&lt;/pre&gt;
        OR
&lt;pre&gt;yarn init&lt;/pre&gt;
It will generate the &lt;code&gt;package.json&lt;/code&gt; file. Yarn is my favorite , so throughout 
in this guide yarn will be used.&lt;/li&gt;
&lt;li&gt;Install webpack locally(recommended)
&lt;pre&gt;yarn add --dev webpack webpack-cli &lt;/pre&gt;
You can see the webpack being added as dev dependencies in package.&lt;/li&gt;
&lt;li&gt;Now lets create a sample project with our usual stuffs.You can find the source files &lt;a href="https://github.com/SaileshSubramanian/webpackGuide"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now the project structure is ready let's bring in the main player &lt;br&gt;
   &lt;code&gt;webpack.config.js&lt;/code&gt;. Create the &lt;code&gt;webpack.config.js&lt;/code&gt; in the root.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now that the initial configuration is ready,lets modify our &lt;code&gt;package.json&lt;/code&gt; to 
add the build command.&lt;/li&gt;
&lt;li&gt;Now let's run the build command
&lt;pre&gt;yarn build&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;We now have a &lt;code&gt;bundle.js&lt;/code&gt; inside the dist folder.For the sake of cache busting 
, include &lt;code&gt;[chunkhash]&lt;/code&gt; in the output js file configuration of webpack. 
So each time the generated js file will be in the format 
&lt;code&gt;bundle.[chunkhash].js&lt;/code&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Naturally our &lt;code&gt;dist&lt;/code&gt; folder will be cluttered with many files. So we need to add &lt;br&gt;
&lt;code&gt;clean-webpack-plugin&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CleanWebpackPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;clean-webpack-plugin&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;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="nx"&gt;CleanWebpackPlugin&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But that does not the serve the whole purpose. So let's add more to the    &lt;code&gt;webpack.config.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working with ES6&lt;/strong&gt;&lt;br&gt;
Let's modify our &lt;code&gt;index.js&lt;/code&gt; and add some behaviour using ES6. Since the code is in ES6 we need to transpile it so that the browser can understand. Here loaders come for the rescue, and do the code transformation for us.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding Babel to the project. We specify the rules in the module section to add 
the each loaders in  &lt;code&gt;webpack.config.js&lt;/code&gt;. 
&lt;i&gt;The &lt;code&gt;test&lt;/code&gt; property identifies which file or files should be transformed.
The &lt;code&gt;use&lt;/code&gt; property indicates which loader should be used to do the 
transforming.&lt;/i&gt;
&lt;pre&gt;yarn add --dev babel-loader @babel/core @babel/preset-env&lt;/pre&gt;
Modify the our &lt;code&gt;webpack.config.js&lt;/code&gt; as below.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
        &lt;span class="nl"&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;js|jsx&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;exclude&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;node_modules&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="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;loader&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="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;presets&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;@babel/preset-env&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="p"&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;Add a &lt;code&gt;.babelrc&lt;/code&gt; file with contents as below.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;     &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;presets&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;@babel/preset-env&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;p&gt;But how do we see the magic happening? So let's add the &lt;code&gt;webpack-dev-server&lt;/code&gt; to run the project locally.&lt;br&gt;
     &lt;/p&gt;
&lt;pre&gt;yarn add --dev webpack-dev-server&lt;/pre&gt;
&lt;br&gt;
Also modify the package.json the script to run the dev server and then run     &lt;code&gt;yarn serve&lt;/code&gt;.&lt;br&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;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;webpack-dev-server --open --config webpack.config.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;With the css preprocessors taking the significant role in the web development
these days , lets create sass files and add loaders to transform and bundle 
it.
&lt;pre&gt;yarn add --dev style-loader css-loader node-sass sass-loader&lt;/pre&gt;
The &lt;code&gt;mini-css-extract-plugin&lt;/code&gt; helps us to extract all styles and bundle it in our  dist directory. Use &lt;code&gt;MiniCssExtractPlugin.loader&lt;/code&gt; instead of style-loader if you need a separate &lt;code&gt;bundle.css&lt;/code&gt; file as the style-loader injects all the styles in the &lt;code&gt;head&lt;/code&gt; element of your html.
&lt;pre&gt;yarn add --dev mini-css-extract-plugin&lt;/pre&gt;
Add the loaders to our &lt;code&gt;webpack.config.js&lt;/code&gt; as below.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="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;MiniCssExtractPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;mini-css-extract-plugin&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;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="nx"&gt;MiniCssExtractPlugin&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="s2"&gt;bundle.[chunkhash].css&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="p"&gt;{&lt;/span&gt;
                &lt;span class="nl"&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;sa|sc|c&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;ss$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nx"&gt;use&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;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;MiniCssExtractPlugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loader&lt;/span&gt;
                    &lt;span class="p"&gt;},&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&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="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sass-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;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now comes the role of plugins. We need to modify our HTML files, copy some of the assets to build folder and so on and to do that we need to add certain webpack plugins.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding &lt;code&gt;HtmlWebpackPlugin&lt;/code&gt; , it generates an HTML file with generated bundle 
files,both js &amp;amp; css, integrated in the &lt;code&gt;script&lt;/code&gt; and &lt;code&gt;link&lt;/code&gt; tags. We can even 
specify the template as well.
&lt;pre&gt; yarn add --dev html-webpack-plugin&lt;/pre&gt;
Now modify our &lt;code&gt;webpack.config.js&lt;/code&gt;to add the plugin.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;HtmlWebpackPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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="p"&gt;.............&lt;/span&gt;

     &lt;span class="nx"&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="nx"&gt;HtmlWebpackPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;My App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/index.html&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;meta&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="s1"&gt;viewport&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;width=device-width, initial-scale=1, user-scalable=no&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;What about assets like fonts, images..Let's add &lt;code&gt;copy-webpack-plugin&lt;/code&gt;. The &lt;br&gt;
 reason why &lt;code&gt;file-loader&lt;/code&gt; was not used because it loads on those assets &lt;br&gt;
 referenced in our modules.&lt;br&gt;
    &lt;/p&gt;
&lt;pre&gt;yarn add --dev copy-webpack-plugin&lt;/pre&gt;
&lt;br&gt;
Add the configurations for the plugin as well inside &lt;code&gt;webpack.config.js&lt;/code&gt;.&lt;br&gt;

&lt;div class="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;CopyPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;copy-webpack-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

   &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;CopyPlugin&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
           &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/assets&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assets&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;p&gt;And finally all our &lt;code&gt;assets&lt;/code&gt; are copied to build directory. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Preparing for Different environments&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;We could actually maintain separate webpack comfiguration files for &lt;br&gt;
 development and production deployment, with production files having &lt;br&gt;
 production configurations included.&lt;/p&gt;

&lt;p&gt;Let's create &lt;code&gt;webpack.common.config.js&lt;/code&gt;. Remove all the contents from the &lt;br&gt;
 current &lt;code&gt;webpack.config.js&lt;/code&gt; and paste it in the new file.Change the output path &lt;br&gt;
 options as &lt;code&gt;path:path.resolve(__dirname, '../dist'),&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the below script in the &lt;code&gt;webpack.config.js&lt;/code&gt; to configure different &lt;br&gt;
 environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="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;webpackMerge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;webpack-merge&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;commonConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;./webpack.common.config.js&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="nx"&gt;env&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;envConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`./webpack.&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="s2"&gt;.config.js`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;webpackMerge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;commonConfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;envConfig&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;p&gt;Make sure you have the &lt;code&gt;webpack-merge&lt;/code&gt; yarn added as dev-dependency. &lt;br&gt;
 Now we can to create &lt;code&gt;webpack.dev.config.js&lt;/code&gt; and &lt;code&gt;webpack.prod.config.js&lt;/code&gt;. &lt;br&gt;
 Include the development specific feature config in the &lt;code&gt;webpack.dev.config.js&lt;/code&gt; &lt;br&gt;
 as below.If they existed in your &lt;code&gt;webpack.common.config&lt;/code&gt;  remove it to avoid &lt;br&gt;
 unexpected results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&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;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;devServer&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
          &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;hot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;contentBase&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;devtool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;inline-source-map&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;Same for the &lt;code&gt;webpack.prod.config.js&lt;/code&gt;. I leave up to you if you require source- &lt;br&gt;
 map in prod mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&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;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="na"&gt;devtool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;source-map&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;Modify the scripts to run for different environment in &lt;code&gt;package.json&lt;/code&gt; to look &lt;br&gt;
 more meaningful.&lt;br&gt;
&lt;/p&gt;

&lt;div class="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;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;webpack-dev-server --open --config build-config/webpack.config.js 
              --env.env=dev&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:dev&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 --config build-config/webpack.config.js 
                  --env.env=dev&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:prod&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 --config build-config/webpack.config.js 
                  --env.env=prod&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;You can again go for optimization techniques available with other webpack &lt;br&gt;
 plugins in the production mode. Since v4 webpack does the optimization for &lt;br&gt;
 you based on the &lt;code&gt;mode&lt;/code&gt;. But you can override those with your own &lt;br&gt;
 configurations. &lt;code&gt;uglify-js&lt;/code&gt; , &lt;code&gt;optimise-css-assets&lt;/code&gt; are most popular.&lt;/p&gt;

&lt;p&gt;Thanks for reading.I hope that was informative .If you have any corrections or &lt;br&gt;
 suggestion, please let me know in the comments section.  Happy Coding !!&lt;/p&gt;

</description>
      <category>webpack</category>
      <category>javascript</category>
      <category>webapps</category>
      <category>es6</category>
    </item>
  </channel>
</rss>
