-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.prod.js
86 lines (83 loc) · 2.58 KB
/
config.prod.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
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const webpack = require("webpack");
const line = "---------------------------------------------------------";
const msg = `❤️❤️❤️ Tell us about your game! - games@phaser.io ❤️❤️❤️`;
process.stdout.write(`${line}\n${msg}\n${line}\n`);
module.exports = {
mode: "production",
entry: "./src/main.ts",
output: {
path: path.resolve(process.cwd(), 'dist'),
filename: "./bundle.min.js"
},
resolve: {
extensions: [".ts", ".js", ".json"]
},
devtool: false,
performance: {
maxEntrypointSize: 2500000,
maxAssetSize: 1200000
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "ts-loader"
},
{
test: [/\.vert$/, /\.frag$/],
use: "raw-loader"
},
{
test: /\.(gif|png|jpe?g|svg|xml|glsl)$/i,
use: "file-loader"
}
]
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false
}
}
})
]
},
plugins: [
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof WEBGL_DEBUG": JSON.stringify(false),
"typeof EXPERIMENTAL": JSON.stringify(false),
"typeof PLUGIN_3D": JSON.stringify(false),
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
"typeof FEATURE_SOUND": JSON.stringify(true)
}),
new HtmlWebpackPlugin({
template: "./index.html"
}),
new CopyPlugin({
patterns: [
{ from: 'public/assets', to: 'assets' },
{ from: 'public/favicon.png', to: 'favicon.png' },
{ from: 'public/style.css', to: 'style.css' }
],
}),
]
};