This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
forked from Windows8964/openarras-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
49 lines (48 loc) · 1.51 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const ClosurePlugin = require('closure-webpack-plugin');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
const CopyPlugin = require("copy-webpack-plugin");
const crypto = require("crypto");
const buildHash = crypto.createHash("sha256").update(Date.now().toString()).digest("hex");
module.exports = {
entry: './clientSrc/app.js',
output: {
filename: `openarras.${buildHash}.js`,
path: path.resolve(__dirname, 'dist'),
},
optimization: {
minimizer: [
new ClosurePlugin({mode: 'STANDARD'}, {
// compiler flags here
//
// for debugging help, try these:
//
// formatting: 'PRETTY_PRINT'
// debug: true,
renaming: true
})
]
},
plugins: [new webpack.DefinePlugin({
arrasBuild: JSON.stringify(buildHash)
}),
new HtmlWebpackPlugin({ // Also generate a test.html
filename: 'index.html',
template: './clientSrc/index.html'
}), new HtmlReplaceWebpackPlugin([
{
pattern: 'openarras.js',
replacement: `openarras.${buildHash}.js`
}
]), new CopyPlugin({
patterns: [
{ from: "./clientSrc/assets", to: "assets" },
{ from: "./clientSrc/favicons", to: "favicons" },
{ from: "./clientSrc/main.css", to: "./" },
{ from: "./clientSrc/buttons", to: "buttons" },
{ from: "./clientSrc/githubstats.json", to: "./"}
],
})],
};