Building Phaser v3.12.0-beta3 results in these errors:
ERROR in ./node_modules/phaser/src/boot/Game.js
Module not found: Error: Can't resolve '../fbinstant/FacebookInstantGamesPlugin' in '/var/aerialdrop3/node_modules/phaser/src/boot'
@ ./node_modules/phaser/src/boot/Game.js 37:37-87
@ ./node_modules/phaser/src/phaser.js
@ ./build/game.js
ERROR in ./node_modules/phaser/plugins/fbinstant/src/Leaderboard.js
Module not found: Error: Can't resolve '../utils/Class' in '/var/aerialdrop3/node_modules/phaser/plugins/fbinstant/src'
@ ./node_modules/phaser/plugins/fbinstant/src/Leaderboard.js 7:12-37
@ ./node_modules/phaser/plugins/fbinstant/src/FacebookInstantGamesPlugin.js
@ ./node_modules/phaser/src/phaser.js
@ ./build/game.js
ERROR in ./node_modules/phaser/plugins/fbinstant/src/Product.js
Module not found: Error: Can't resolve '../utils/object/GetFastValue' in '/var/aerialdrop3/node_modules/phaser/plugins/fbinstant/src'
@ ./node_modules/phaser/plugins/fbinstant/src/Product.js 7:19-58
@ ./node_modules/phaser/plugins/fbinstant/src/FacebookInstantGamesPlugin.js
@ ./node_modules/phaser/src/phaser.js
@ ./build/game.js
ERROR in ./node_modules/phaser/plugins/fbinstant/src/Purchase.js
Module not found: Error: Can't resolve '../utils/object/GetFastValue' in '/var/aerialdrop3/node_modules/phaser/plugins/fbinstant/src'
@ ./node_modules/phaser/plugins/fbinstant/src/Purchase.js 7:19-58
@ ./node_modules/phaser/plugins/fbinstant/src/FacebookInstantGamesPlugin.js
@ ./node_modules/phaser/src/phaser.js
@ ./build/game.js
I updated my package.json with from beta2 to beta3 and this was the error I got building with webpack. FB Instant support should be optional.
I'm seeing this as well, but I modified my webpack config and fixed it:
new webpack.DefinePlugin({
'typeof CANVAS_RENDERER': JSON.stringify(false),
'typeof WEBGL_RENDERER': JSON.stringify(true),
'typeof PLUGIN_FBINSTANT': JSON.stringify(false),
}),
Nice fix! I am pretty sure I remember being told that was not necessary in the webpack config anymore. As I haven't had that portion in my webpack config since some of the first Phaser 3 releases.
There are 3 new build defs you鈥檒l need to add, one for camera 3D, one for FB and the experimental flag. If you don鈥檛 add them it鈥檒l include loads of stuff you really don鈥檛 want included yet.
To clarify further, the complete set of build flags are:
plugins: [
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof EXPERIMENTAL": JSON.stringify(false),
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
"typeof PLUGIN_FBINSTANT": JSON.stringify(false)
})
],
You must add these to your webpack config if you want to use beta 3 (or 4)
It's safe to toggle all of them on / off except the FBINSTANT one, that should be left as false for now.
In the final 3.12 FB Instant will just be a global plugin, but the others will remain required.
Does anyone using angular-cli 6.0 have a solution to this problem?
If you're just using the pre-built version of Phaser with Angular then you don't need to do anything. If you're trying to 'import' it, or similar, direct from source, then you'll need to define the above as globals where-ever you'd do that in Angular.
I'm using the node package [email protected]. I have nothing to define in that case ? I reproduced on StackBlitz :
https://stackblitz.com/edit/angular-xpi2v2?embed=1&file=src/app/app.component.ts
As I said above, if you're pulling in the dist file from the node package, you're fine, otherwise yes, you _should_ (but don't need) to declare the globals when 3.12 is live, but for beta 3 and 4 you'll need to.
Thanks. 馃憤
Closing as I fixed the issues being thrown by the FB plugin. You should still specify the property in your build file if you don't want it included though, but it no longer errors webpack.
This just happened on 3.18.1 using webpack. A simple import "phaser" would import the -FB version. @goldfire 's post fixed it.
Most helpful comment
To clarify further, the complete set of build flags are:
You must add these to your webpack config if you want to use beta 3 (or 4)
It's safe to toggle all of them on / off except the FBINSTANT one, that should be left as
falsefor now.In the final 3.12 FB Instant will just be a global plugin, but the others will remain required.