January 2018
Intermediate to advanced
336 pages
7h 22m
English
At this point, you have the basic outline of a project that will build a front end using webpack, but currently it doesn’t actually build anything. In this section, we’ll get the project to the point where it generates an index.html file and produces a distributable JavaScript bundle to go along with it.
First, to generate the HTML we’ll need the html-webpack-plugin module. Install it with npm.
| | $ npm install --save-dev --save-exact html-webpack-plugin@2.30.1 |
Next, open your webpack.config.js and update it to contain the following content:
| | 'use strict'; |
| | const path = require('path'); |
| | const distDir = path.resolve(__dirname, 'dist'); |
| | |
| | const HtmlWebpackPlugin ... |
Read now
Unlock full access