-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
73 lines (70 loc) · 2.95 KB
/
webpack.dev.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
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.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:dev']
}),
new webpack.DefinePlugin({
'DEBUG': true,
// Do not modify these manually, you may break things...
'DEFAULT_GAME_WIDTH': /*[[DEFAULT_GAME_WIDTH*/384/*DEFAULT_GAME_WIDTH]]*/,
'DEFAULT_GAME_HEIGHT': /*[[DEFAULT_GAME_HEIGHT*/216/*DEFAULT_GAME_HEIGHT]]*/,
'MAX_GAME_WIDTH': /*[[MAX_GAME_WIDTH*/384/*MAX_GAME_WIDTH]]*/,
'MAX_GAME_HEIGHT': /*[[MAX_GAME_HEIGHT*/216/*MAX_GAME_HEIGHT]]*/,
'SCALE_MODE': JSON.stringify(/*[[SCALE_MODE*/'SHOW_ALL'/*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
]),
'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: 'DEV MODE: Antonius',
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/' }
]
},
devtool: 'source-map'
};