-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dist.config.js
82 lines (77 loc) · 3.14 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
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var WebpackShellPlugin = require('webpack-shell-plugin');
module.exports = {
entry: path.join(__dirname, 'src/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 WebpackShellPlugin({
onBuildStart: ['npm run assets']
}),
new webpack.DefinePlugin({
'DEBUG': false,
// Do not modify these manually, you may break things...
'DEFAULT_GAME_WIDTH': /*[[DEFAULT_GAME_WIDTH*/1024/*DEFAULT_GAME_WIDTH]]*/,
'DEFAULT_GAME_HEIGHT': /*[[DEFAULT_GAME_HEIGHT*/640/*DEFAULT_GAME_HEIGHT]]*/,
'MAX_GAME_WIDTH': /*[[MAX_GAME_WIDTH*/1136/*MAX_GAME_WIDTH]]*/,
'MAX_GAME_HEIGHT': /*[[MAX_GAME_HEIGHT*/768/*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',
'Press Start 2P'
]),
'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 webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
screw_ie8: true
}),
new HtmlWebpackPlugin({
title: 'ProfitWarning - P0NG',
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(\/|\\)/, 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', exclude: '/node_modules/' }
]
}
};