[chore] Introduce HTML-Webpack

This issue means that any changes to the HTML has to happen in the
`.\src\index.html` file rather than the `.\index.html`. This makes the
`index.html` in the root now a build artifact the same way that files in
`dist\` are.
This commit is contained in:
Steven Evans
2018-08-30 10:43:18 -04:00
parent aa18420e0c
commit 552ce183c1
5 changed files with 1392 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
var path = require('path');
var webpack = require('webpack');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = (env, argv) => ({
plugins: [
@@ -16,6 +17,42 @@ module.exports = (env, argv) => ({
jQuery: "jquery",
$: "jquery"
}),
new HtmlWebpackPlugin({
title: "Bitburner" + (argv.mode === 'development' ? ' - development' : ""),
template: "src/index.html",
favicon: "favicon.ico",
meta: {},
minify: argv.mode === 'development' ? false : {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false,
collapseWhitespace: false,
conservativeCollapse: false,
html5: true,
includeAutoGeneratedTags: false,
keepClosingSlash: true,
minifyCSS: false,
minifyJS: false,
minifyURLs: false,
preserveLineBreaks: false,
preventAttributesEscaping: false,
processConditionalComments: false,
quoteCharacter: "\"",
removeAttributeQuotes: false,
removeComments: false,
removeEmptyAttributes: false,
removeEmptyElements: false,
removeOptionalTags: false,
removeScriptTypeAttributes: false,
removeStyleLinkTypeAttributes: false,
removeTagWhitespace: false,
sortAttributes: false,
sortClassName: false,
useShortDoctype: false
},
excludeChunks: [
"tests/tests"
]
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"