Skip to content

Commit 4fe3544

Browse files
gaearonvjeux
authored andcommitted
Tweak HTML generation
1 parent 9a98851 commit 4fe3544

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

index.html

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<title>My React App</title>
6+
<title>My First React App</title>
77
</head>
88
<body>
9-
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js) with the correct HTML tags, which is why they are missing in this HTML file. -->
9+
<!--
10+
This HTML file is a template.
11+
If you open it directly in the browser, you will see an empty page.
12+
13+
You can add webfonts, meta tags, or analytics to this file.
14+
The build step will place the bundled scripts into the <body> tag.
15+
16+
To begin the development, run `npm start` in this folder.
17+
To create a production bundle, use `npm run build`.
18+
-->
1019
</body>
1120
</html>

webpack.config.dev.js

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ module.exports = {
7373
return [autoprefixer];
7474
},
7575
plugins: [
76-
// TODO: infer from package.json?
7776
new HtmlWebpackPlugin({
7877
inject: true,
7978
template: path.resolve(__dirname, relative, 'index.html'),

webpack.config.prod.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,21 @@ module.exports = {
7373
return [autoprefixer];
7474
},
7575
plugins: [
76-
// TODO: infer from package.json?
7776
new HtmlWebpackPlugin({
7877
inject: true,
7978
template: path.resolve(__dirname, relative, 'index.html'),
79+
minify: {
80+
removeComments: true,
81+
collapseWhitespace: true,
82+
removeRedundantAttributes: true,
83+
useShortDoctype: true,
84+
removeEmptyAttributes: true,
85+
removeStyleLinkTypeAttributes: true,
86+
keepClosingSlash: true,
87+
minifyJS: true,
88+
minifyCSS: true,
89+
minifyURLs: true
90+
}
8091
}),
8192
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
8293
new webpack.optimize.OccurrenceOrderPlugin(),

0 commit comments

Comments
 (0)