phaser: Getting ReferenceError: PIXI is not defined with the v2.0.6 in the v2.0.4 was ok.
Line 11549 (PIXI.InteractionManager = PIXI.InteractionManager || function () {}š
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = PIXI;
}
exports.PIXI = PIXI;
} else if (typeof define !== 'undefined' && define.amd) {
define(PIXI); // <-- because of this PIXI turns undefined
} else {
root.PIXI = PIXI;
}
Iām using require.js
Possible solution but NOT optimal:
Create a file āotherModules/phaser/phaser-wrapper.jsā with this content:
// This exports Phaser to window.
require('phaserUnFixed');
// And then we return it here.
module.exports = Phaser;
Now in your webpack config in resolve.alias add those lines:
phaserUnFixed : "nodeModules/phaser/build/custom/phaser-arcade-physics.js",
phaser : "otherModules/phaser/phaser-wrapper.js",
This will make your app to load the phaser-wrapper.js file when you request phaser. This file requires the real phaser file which exports the global Phaser variable. Then the module is properly exported.
Iāve done the same for PIXI.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 15
Same here , tried to put phaser.min.js in āclient/libsā folder for meteor, didnāt work, also tried to install using
npm install phaserimport Phaser from 'phaser'Still no luck