Jump to content

Phaser fails to detect PIXI using Browserify


jmeyers919
 Share

Recommended Posts

I'm attempting to get started with Phaser (2.4.0), but whenever I require phaser into my project, I receive this error:

Uncaught TypeError: Cannot read property 'prototype' of undefined

at phaser:35790 which refers to this line:

Phaser.TileSprite.prototype = Object.create(PIXI.TilingSprite.prototype);

Just above this line is the definition for the Phaser.TileSprite class, so the error must be referring to PIXI.TilingSprite.prototype. I've tried manually inserting PIXI into the window object like this:

window.PIXI = require("pixi.js");

But this does not solve the issue.

 

If anyone else has run into this issue and could tell me what I'm doing wrong, that would be much appreciated. Here's some additional information: 

 

Javascript build task (gulp):

gulp.task("babel", () => {  return browserify("./lib/app.js", {debug: true})    .transform(babelify.configure({      ignore: /node_modules/    }))    .bundle()    .on("error", function(error) {      console.log(`Babel Error: ${error}`);      this.emit("end"); // keeps task from hanging on error    })    .pipe(fs.createWriteStream("./bin/app.js"));});

 

dependencies:

"devDependencies": {  "babel": "^5.8.3",  "babel-core": "^5.8.3",  "babelify": "^6.1.3",  "browserify": "^11.0.0",  "browserify-incremental": "^3.0.1",  "express": "^4.13.1",  "gulp": "^3.9.0",  "gulp-ruby-sass": "^1.0.5",  "lodash": "^3.10.0"},"dependencies": {  "pixi.js": "^3.0.7",  "phaser": "^2.4.0"}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...