forked from dangeredwolf/ModernDeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
101 lines (97 loc) · 2.61 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require('terser-webpack-plugin');
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
// let commitHash = require('child_process')
// .execSync('git rev-parse --short HEAD')
// .toString()
// .trim();
module.exports = {
entry: {
"moderndeck": "./src/Boot/Boot.ts",
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "common/assets/js"),
environment: {
arrowFunction: true
},
assetModuleFilename: "common/assets/[name].[ext][query]"
},
devtool: "source-map",
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".png", ".jpg", ".mp3", ".mp4", ".aac", ".webp"],
},
experiments: {
topLevelAwait: true
},
plugins: [
// new webpack.DefinePlugin({
// __BUILD_ID__: JSON.stringify(buildId)
// }),
new webpack.BannerPlugin({
banner:
`ModernDeck ${require("./package.json").version}, built ${new Date().toISOString()}
(c) 2014-${new Date().toISOString().slice(0,4)} dangered wolf, released under MIT license.
Made with <3
`,
})
],
mode: "production",
module: {
rules: [
{
test: /\.(png|svg|jpg|jpeg|gif|webp|mp3|woff|woff2|eot|ttf|otf|aac)$/i,
type: "asset/resource"
},
{
test: /\.(csv|tsv)$/i,
use: ["csv-loader"],
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.m?js$/,
// ModernDeck only uses ES6 imports, `require` is only used to interface with Node in the Electron version
parser: {
amd: false, // disable AMD
commonjs: false, // disable CommonJS
system: false, // disable SystemJS
requireInclude: false, // disable require.include
requireEnsure: false, // disable require.ensure
requireContext: false, // disable require.context
browserify: false, // disable special handling of Browserify bundles
requireJs: false, // disable requirejs.*
node: false, // disable __dirname, __filename, module, require.extensions, require.main, etc.
commonjsMagicComments: false // disable magic comments support for CommonJS
},
use: {
loader: "babel-loader",
options: {
presets: [
["@babel/preset-env", { targets: "firefox 52" }]
],
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-exponentiation-operator"
]
}
}
}
]},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
mangle: false
}
})
],
},
}