Skip to content

Commit

Permalink
update html webpack plugin setup
Browse files Browse the repository at this point in the history
  • Loading branch information
DonAdam2 committed Sep 29, 2023
1 parent 3a6e10a commit 746ac48
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
53 changes: 37 additions & 16 deletions buildTools/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,43 @@ module.exports = (env, options) => {
extensions: ['.js', '.ts', '.tsx', '.json'],
}),
new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({
title,
template: `${publicDirPath}/index.html`,
filename: 'index.html',
inject: 'body',
favicon: `${publicDirPath}/assets/images/favicon.png`,
meta: {
title,
description,
keywords,
//coming from scripts/start.js file
...(isDevelopment && { url: `${devServer}:${options.port}` }),
'apple-mobile-web-app-capable': 'yes',
'mobile-web-app-capable': 'yes',
},
}),
new HtmlWebpackPlugin(
Object.assign(
{},
{
inject: true,
template: `${publicDirPath}/index.html`,
title,
filename: 'index.html',
favicon: `${publicDirPath}/assets/images/favicon.png`,
meta: {
title,
description,
keywords,
//coming from scripts/start.js file
...(isDevelopment && { url: `${devServer}:${options.port}` }),
'apple-mobile-web-app-capable': 'yes',
'mobile-web-app-capable': 'yes',
},
},
!isDevelopment
? {
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
: undefined
)
),
new NodePolyfillPlugin(),
],
};
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down

0 comments on commit 746ac48

Please sign in to comment.