-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
47 lines (42 loc) · 1.37 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
var path = require("path");
var webpackMerge = require("webpack-merge");
// root directory ( useful, when config is within a sub folder )
var rootDir = path.resolve(__dirname);
// import webpack config from ionic
var ionicWebpackConfig = require(path.resolve(rootDir, "node_modules", "@ionic", "app-scripts", "config", "webpack.config"));
// necessary for expose loader
var phaserModule = path.join(rootDir, "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 webpackExtension = {
resolve: {
// alias resolve (begin)
alias: {
"pixi": pixi,
"p2": p2,
"phaser-ce": phaser
}
// alias resolve (end)
},
module: {
loaders: [
// exposing pixi, correct phaser and p2 into global scope (begin)
{
test: /pixi\.js/,
loader: "expose-loader?PIXI"
}, {
test: /phaser-split\.js/,
loader: "expose-loader?Phaser"
}, {
test: /p2\.js/,
loader: "expose-loader?p2"
}
// exposing pixi, correct phaser and p2 into global scope (end)
]
}
};
module.exports = {
dev: webpackMerge.smart(ionicWebpackConfig.dev, webpackExtension),
prod: webpackMerge.smart(ionicWebpackConfig.prod, webpackExtension)
};