-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
76 lines (67 loc) · 1.92 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
72
73
74
75
76
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin')
// Phaser webpack config
var phaserModule = path.join(__dirname, '/node_modules/phaser-ce/');
var phaser = path.join(phaserModule, 'build/custom/phaser-split.js');
var pixi = path.join(phaserModule, 'build/custom/pixi.js');
var p2 = path.join(phaserModule, 'build/custom/p2.js');
var phaserInput = path.join(__dirname, '/node_modules/@orange-games/phaser-input/build/phaser-input.js');
var distOutput = {
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'round-the-world-game.min.js',
libraryTarget:'umd',
library: 'roundTheWorldGame',
umdNamedDefine: true
}
}
var demoConfigExtras = {
plugins: [
new CopyWebpackPlugin([
{from: 'assets/**/*', to: path.resolve(__dirname, 'demo/')},
])
],
output: {
path: path.resolve(__dirname, 'demo/lib/'),
filename: 'round-the-world-game.min.js',
libraryTarget:'umd',
library: 'roundTheWorldGame',
umdNamedDefine: true
}
}
var basicConfig = {
entry: './src/index.js',
module: {
rules: [
{ test: /\.js$/, use: ['babel-loader'], include: path.join(__dirname, 'client/src') },
{ test: /pixi\.js/, use: ['expose-loader?PIXI'] },
{ test: /phaser-split\.js$/, use: ['expose-loader?Phaser'] },
{ test: /p2\.js/, use: ['expose-loader?p2'] },
{ test: /phaser-input\.js$/, use: ['exports-loader?PhaserInput=true'] }, {
test: /\.(png|jpg|gif|ogg)$/,
use: [
{
loader: 'file-loader',
options: {
emitFile: false
}
}
]
}
]
},
resolve: {
alias: {
phaser,
pixi,
p2,
'phaser-input': phaserInput,
},
},
devtool: 'source-map'
}
var distConfig = Object.assign(basicConfig, distOutput);
var demoConfig = Object.assign(basicConfig, demoConfigExtras);
module.exports = [
distConfig, demoConfig
];