-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
71 lines (67 loc) · 1.77 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
'use strict'
const LiveReloadPlugin = require('webpack-livereload-plugin')
, devMode = require('.').isDevelopment
/**
* Fast source maps rebuild quickly during development, but only give a link
* to the line where the error occurred. The stack trace will show the bundled
* code, not the original code. Keep this on `false` for slower builds but
* usable stack traces. Set to `true` if you want to speed up development.
*/
, USE_FAST_SOURCE_MAPS = false
, path = require('path')
, phaserModule = path.join(__dirname, '/node_modules/phaser/')
, phaser = path.join(phaserModule, 'build/custom/phaser-split.js')
, pixi = path.join(phaserModule, 'build/custom/pixi.js')
, p2 = path.join(phaserModule, 'build/custom/p2.js')
module.exports = {
entry: './app/index.jsx',
output: {
path: __dirname,
filename: './public/bundle.js'
},
context: __dirname,
devtool: devMode && USE_FAST_SOURCE_MAPS
? 'cheap-module-eval-source-map'
: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.json', '*'],
alias: {
'phaser': phaser,
'pixi': pixi,
'p2': p2
}
},
module: {
rules: [{
test: /jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['react', 'es2015', 'stage-2']
}
}]
}, {
test: /pixi\.js/,
use: [{
loader: 'expose-loader',
options: 'PIXI'
}]
}, {
test: /phaser-split\.js$/,
use: [{
loader: 'expose-loader',
options: 'Phaser'
}]
}, {
test: /p2\.js/,
use: [{
loader: 'expose-loader',
options: 'p2'
}]
}],
},
plugins: devMode
? [new LiveReloadPlugin({ appendScriptTag: true })]
: []
}