Skip to content
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

Loading a script should default its type to "script" #5994

Closed
ItsGravix opened this issue Feb 7, 2022 · 2 comments · Fixed by #5995
Closed

Loading a script should default its type to "script" #5994

ItsGravix opened this issue Feb 7, 2022 · 2 comments · Fixed by #5995

Comments

@ItsGravix
Copy link

Version

  • Phaser Version: v3.60.0-beta.4
  • Operating system: Windows 11
  • Browser: Google Chrome

Description

Loading a script should default its type to "script" to prevent older code from breaking.
If a type is not provided, this error will be thrown:

Uncaught Error: Invalid Loader.false key
    at ScriptFile.File (phaser.js:107085:19)
    at new ScriptFile (phaser.js:116182:14)
    at LoaderPlugin.script (phaser.js:116289:22)
    at EventEmitter.<anonymous> (<anonymous>:116:21)
    at EventEmitter.emit (phaser.js:197:35)
    at LoaderPlugin.<anonymous> (<anonymous>:273:37)
    at LoaderPlugin.emit (phaser.js:200:35)
    at LoaderPlugin.loadComplete (phaser.js:108625:14)
    at LoaderPlugin.fileProcessComplete (phaser.js:108591:18)
    at ImageFile.onProcessComplete (phaser.js:107408:21)

Example Test Code

Non-working code:
scene.load.script('RoomScene', 'assets/RoomScene.js');

Working Code:
scene.load.script('RoomScene', 'assets/RoomScene.js', 'script');

@vforsh
Copy link
Contributor

vforsh commented Feb 7, 2022

Ha, I was just going to report this issue

Here is the live example - https://codesandbox.io/s/wandering-microservice-stecg?file=/src/index.ts

samme added a commit to samme/phaser that referenced this issue Feb 7, 2022
@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants