-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.dist.config.js
117 lines (114 loc) · 3.29 KB
/
webpack.dist.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var webpack = require("webpack");
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var CleanWebpackPlugin = require("clean-webpack-plugin");
var WebpackSynchronizableShellPlugin = require("webpack-synchronizable-shell-plugin");
module.exports = {
target: "web",
mode: "production",
entry: path.join(__dirname, "client/app.ts"),
output: {
path: path.join(__dirname, "dist"),
filename: "game.min.js"
},
resolve: {
extensions: [".ts", ".js"],
alias: {
pixi: path.join(__dirname, "node_modules/phaser-ce/build/custom/pixi.js"),
phaser: path.join(
__dirname,
"node_modules/phaser-ce/build/custom/phaser-split.js"
),
p2: path.join(__dirname, "node_modules/phaser-ce/build/custom/p2.js"),
assets: path.join(__dirname, "assets/")
}
},
plugins: [
new WebpackSynchronizableShellPlugin({
onBuildStart: {
scripts: ["npm run assets"],
blocking: true,
parallel: false
}
}),
new webpack.DefinePlugin({
DEBUG: false,
// Do not modify these manually, you may break things...
DEFAULT_GAME_WIDTH: /*[[DEFAULT_GAME_WIDTH*/ 800 /*DEFAULT_GAME_WIDTH]]*/,
DEFAULT_GAME_HEIGHT: /*[[DEFAULT_GAME_HEIGHT*/ 500 /*DEFAULT_GAME_HEIGHT]]*/,
MAX_GAME_WIDTH: /*[[MAX_GAME_WIDTH*/ 888 /*MAX_GAME_WIDTH]]*/,
MAX_GAME_HEIGHT: /*[[MAX_GAME_HEIGHT*/ 600 /*MAX_GAME_HEIGHT]]*/,
SCALE_MODE: JSON.stringify(
/*[[SCALE_MODE*/ "USER_SCALE" /*SCALE_MODE]]*/
),
// The items below most likely the ones you should be modifying
GOOGLE_WEB_FONTS: JSON.stringify([
// Add or remove entries in this array to change which fonts are loaded
"Barrio"
]),
SOUND_EXTENSIONS_PREFERENCE: JSON.stringify([
// Re-order the items in this array to change the desired order of checking your audio sources (do not add/remove/modify the entries themselves)
"webm",
"ogg",
"m4a",
"mp3",
"aac",
"ac3",
"caf",
"flac",
"mp4",
"wav"
])
}),
new CleanWebpackPlugin([path.join(__dirname, "dist")]),
new HtmlWebpackPlugin({
title: "example panoptyk game",
template: path.join(__dirname, "templates/index.ejs")
})
],
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000,
inline: true,
watchOptions: {
aggregateTimeout: 300,
poll: true,
ignored: /node_modules/
}
},
module: {
rules: [
{ test: /\.ts$/, enforce: "pre", loader: "tslint-loader" },
{
test: /assets(\/|\\)/,
type: "javascript/auto",
loader: "file-loader?name=assets/[hash].[ext]"
},
{ test: /pixi\.js$/, loader: "expose-loader?PIXI" },
{ test: /phaser-split\.js$/, loader: "expose-loader?Phaser" },
{ test: /p2\.js$/, loader: "expose-loader?p2" },
{
test: /\.ts$/,
loader: "ts-loader",
options: {
configFile: path.join(__dirname, "client.tsconfig.json")
},
exclude: "/node_modules/"
}
]
},
performance: {
hints: false
},
externals: {
uws: "uws"
},
node: {
fs: "empty",
net: "empty",
express: "empty",
http: "empty",
"socket.io": "empty"
}
};