Skip to content

Commit 3d45910

Browse files
committed
Merge branch 'pr/2331' into dev
# Conflicts: # README.md
2 parents eff10ce + 1083fff commit 3d45910

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

Gruntfile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ module.exports = function (grunt) {
400400
grunt.task.run('arcadephysics');
401401
grunt.task.run('nophysics');
402402
grunt.task.run('minimum');
403+
grunt.task.run('split');
403404

404405
});
405406

@@ -443,9 +444,10 @@ module.exports = function (grunt) {
443444
grunt.registerTask('split', 'Compile Phaser to dist folder and splits the globals into single files', function() {
444445

445446
grunt.option('exclude', 'ninja,creature');
446-
grunt.option('filename', 'phaser');
447+
grunt.option('filename', 'phaser-split');
447448
grunt.option('sourcemap', true);
448449
grunt.option('copy', false);
450+
grunt.option('copycustom', true);
449451
grunt.option('uglify', true);
450452
grunt.option('split', true);
451453

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,46 @@ As a result of this work the minimum build size of Phaser is now just 80KB minif
183183

184184
See the [Creating a Custom Phaser Build](http://phaser.io/tutorials/creating-custom-phaser-builds) tutorial for details.
185185

186+
### Webpack
187+
188+
Starting from Phaser 2.4.5 we now include a custom build for Webpack.
189+
190+
You need to add `p2` as a dependency.
191+
192+
###### Webpack config
193+
```
194+
var path = require('path');
195+
var webpack = require('webpack');
196+
197+
var phaserModule = path.join(__dirname, '/node_modules/phaser/');
198+
var phaser = path.join(phaserModule, 'build/custom/phaser-split.js'),
199+
pixi = path.join(phaserModule, 'build/custom/pixi.js'),
200+
p2 = path.join(phaserModule, 'build/custom/p2.js');
201+
202+
module.exports = {
203+
...
204+
module: {
205+
loaders: [
206+
{ test: /pixi.js/, loader: "script" },
207+
]
208+
},
209+
resolve: {
210+
alias: {
211+
'phaser': phaser,
212+
'pixi.js': pixi,
213+
'p2': p2,
214+
}
215+
}
216+
...
217+
}
218+
```
219+
###### Main js file
220+
```
221+
require('pixi.js');
222+
require('p2');
223+
require('phaser');
224+
```
225+
186226
### Building from source
187227

188228
Should you wish to build Phaser from source you can take advantage of the provided [Grunt](http://gruntjs.com/) scripts. Ensure you have the required packages by running `npm install` first.

0 commit comments

Comments
 (0)