Skip to content

Commit 3b333ee

Browse files
committed
configure html-webpack-plugin
create an index.html template and add the plugin to the webpack config
1 parent 1c8fc67 commit 3b333ee

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<meta name="referrer" content="origin" />
7+
<meta name="description" content="Page description" />
8+
<title>Boilerplate!</title>
9+
</head>
10+
<body>
11+
</body>
12+
</html>
13+

webpack.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// webpack.config.js
22
const path = require("path");
3+
const HtmlWebpackPlugin = require("html-webpack-plugin");
34

45
// We'll refer to our source and dist paths frequently, so let's store them here
56
const PATH_SOURCE = path.join(__dirname, "./src");
@@ -84,5 +85,13 @@ module.exports = (env) => {
8485
},
8586
],
8687
},
88+
plugins: [
89+
// This plugin will generate an HTML5 file that imports all our Webpack
90+
// bundles using <script> tags. The file will be placed in `output.path`.
91+
// https://github.com/jantimon/html-webpack-plugin
92+
new HtmlWebpackPlugin({
93+
template: path.join(PATH_SOURCE, "./index.html"),
94+
}),
95+
],
8796
};
8897
};

0 commit comments

Comments
 (0)