New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to exclude SoundManager in custom build #4428
Comments
I also tried doing this yesterday, slimming down Phaser3 omitting some of the larger chunks I didn't want, such as tilemaps, physics, rendertexture, sounds, tilesprite, keyboard, gamepad, various file type loaders etc. As you've found, sound dependency cannot be removed solely via the webpack config because SoundManagerCreator is required in core/game.js and referenced in scene/SceneManager.js:loadComplete(). In my test case I only had to knock out the Sound: require('./sound') from the webpack config and edit the two files mentions above to get it going without Phaser sounds, but now I have the headache of edited source files to keep intact with git updates. I think some chunks of the Phaser lib should be more easily excluded. When their dependency is in the source code then some more of those conditional compile typedef's could do the job, just like CANVAS_RENDERER does. What I liked about PhaserV2 was the ability to override almost any functionality of the lib without touching it just by supplying replacement prototype functions. |
There is a new webpack config Please can you test? |
When setting FEATURE_SOUND to false an exception is thrown "Cannot read property 'onBlurPausedSounds' of null" on checking this.game.sound.onBlurPausedSounds in SceneManager.loadComplete() |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Yup, that's got it. Though using the webpack flag instead would would have resulted in less/quicker code, ie
|
Version
Description
As described in devlog 127 (https://phaser.io/phaser3/devlog/127), doing a custom build of phaser that excludes the sound manager should remove those files from the output. However, because of
SoundManagerCreator
being required incore/Games.j
, a lot of the sound code gets included anyway (and is leading to errors with the onBlur, etc events).Additional Information
I assume this isn't intended behavior based on the comments in the devlog, but I'm not sure in the broader context of the engine what the best approach to fix it is.
The text was updated successfully, but these errors were encountered: