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

Bug: V8.1.0 Can't extends Application or Container #10487

Open
AG2023 opened this issue Apr 29, 2024 · 5 comments
Open

Bug: V8.1.0 Can't extends Application or Container #10487

AG2023 opened this issue Apr 29, 2024 · 5 comments
Assignees
Labels
👯‍♀️ Needs Reproduction Very common: basically need an example that reproduces the issue so that it's easier to identify.

Comments

@AG2023
Copy link

AG2023 commented Apr 29, 2024

Current Behavior

I tried to extends PIXI.Application to create a game's main class, but when I run the code, browser threw an error :Uncaught (in promise) TypeError: Class constructor _Application cannot be invoked without 'new'.

The code of main class:

export class Game extends PIXI.Application {
  constructor(options) {
    super(options)
  }
}

The code to create game instance:

window.onload = async function () {
  const dom = document.getElementById('my_game');

  const options = {width: 1280, height: 720, backgroundColor: 0x111111, sharedTicker: true, transparent: false};
  const game = new Game();
  await game.init(options);
  dom .appendChild(game.canvas);
};

I do samething in pixi.js v6.5.4, it works OK,but in v8.1.0, it threw an error.

Try for Container, similar error occurs: Uncaught (in promise) TypeError: Class constructor Container cannot be invoked without 'new'.

The JS code is ES6, and is compiled into ES5.

Expected Behavior

All class could be extended.

Steps to Reproduce

Please run the code.

Environment

  • pixi.js version: v8.1.0
  • Browser & Version: Chrome 123.0.6312.124
  • OS & Version: Windows 11
  • Running Example: **

Possible Solution

No response

Additional Information

No response

@ShukantPal
Copy link
Member

Please provide a reproduction - I can extend Application without this type of issue.

@bigtimebuddy
Copy link
Member

Compiling to ES5 could present issues. Need more specifics about what's going on, and yes a reproduction.

@bigtimebuddy bigtimebuddy added the 👯‍♀️ Needs Reproduction Very common: basically need an example that reproduces the issue so that it's easier to identify. label May 5, 2024
@AG2023
Copy link
Author

AG2023 commented May 7, 2024

Here is a test URL: https://agtesta.blob.core.windows.net/rmg/dev/pixi_8/qa_24.05.07.12/index.html

This time, the error is: Uncaught TypeError: Super expression must either be null or a function.

pixi8_1

pixi8_2

pixi8_3

@bigtimebuddy
Copy link
Member

Do you have a link to the repository?

@AG2023
Copy link
Author

AG2023 commented May 9, 2024

I simplified the project,here is the source code:
https://agtesta.blob.core.windows.net/rmg/temp/Pixi81.rar

Please follow the steps to test the code in IDEA:
pixi8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👯‍♀️ Needs Reproduction Very common: basically need an example that reproduces the issue so that it's easier to identify.
Projects
None yet
Development

No branches or pull requests

4 participants