aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
authorcaleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu>2022-03-10 23:21:38 -0500
committercaleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu>2022-03-10 23:21:38 -0500
commitdc208478fd18a4e28c0083641bf405170859fc58 (patch)
tree1fad0ecbaf5639d02908b5f9c9f31f1878ee446c /webpack.config.js
parent6dd1b296c2dd1d7462dd8514dff43db59ac8dd19 (diff)
Magnum Opus pt1
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 75a8c0b..06b067d 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -3,6 +3,10 @@
const path = require('path');
const dotenv = require('dotenv');
const webpack = require('webpack');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
+const WorkboxPlugin = require('workbox-webpack-plugin');
+const glob = require('glob');
// this will update the process.env with environment variables in .env file
dotenv.config();
@@ -12,6 +16,10 @@ module.exports = {
ui: './webAO/ui.js',
client: './webAO/client.js',
master: './webAO/master.js',
+ dom: glob.sync('./webAO/dom/*.js'),
+ },
+ node: {
+ global: true,
},
devtool: 'source-map',
devServer: {
@@ -50,8 +58,9 @@ module.exports = {
],
},
output: {
- path: path.resolve(__dirname, 'webAO'),
- filename: '[name].b.js',
+ path: path.resolve(__dirname, 'dist'),
+ filename: '[name].[contenthash].bundle.js',
+ clean: true,
},
performance: {
hints: false,
@@ -59,9 +68,33 @@ module.exports = {
maxAssetSize: 512000,
},
plugins: [
+ new CopyPlugin({
+ patterns: [
+ { from: path.resolve(__dirname, 'webAO', 'styles'), to: 'styles' },
+ { from: path.resolve(__dirname, 'static') },
+ { from: path.resolve(__dirname, 'webAO', 'golden'), to: 'golden' },
+ { from: path.resolve(__dirname, 'webAO', 'lib'), to: 'lib' },
+ { from: path.resolve(__dirname, 'webAO', 'sounds'), to: 'sounds' },
+ ],
+ }),
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ template: 'public/index.html',
+ chunks: ['master', 'sw'],
+ title: 'Attorney Online',
+ }),
+
+ new HtmlWebpackPlugin({
+ title: 'Attorney Online',
+ filename: 'client.html',
+ chunks: ['client', 'ui', 'dom'],
+ template: 'public/client.html',
+ }),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env),
}),
+ new WorkboxPlugin.GenerateSW(),
+
],
};