

In other words, index.pug is the main file and it will extend from layout.pug that, in turn, includes other Pug files to compose itself. In a template, a block is simply a block of Pug that a child template may replace.

Inside the src folder create a new index.pug file and then create a simple layout inside it. Template inheritance works via the block and extends keywords. Npm i -D pug pug-loader html-webpack-pluginĢ.

Even if we don’t need it for this short tutorial, it’s good to know how you can do it. With this, we defined an entry and output point for our application, the port for the development server and we created a simple boilerplate to figure it out whether we run the the webpack command in production or development mode. In order to do this differentiation between production and development, then we must write in the following way const path = require('path') const config = If we want to run the webpack command both in development mode and production mode using our scripts then we must create a separate config object with the common configuration and then based on the arguments of the webpack command we will add diferent rules.
