pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.42k stars 180 forks source link

Bug: Cannot use canvas renderer #426

Closed salojoo closed 1 year ago

salojoo commented 1 year ago

Current Behavior

Cannot use canvas with legacy pixi package.

  1. First error is Unable to auto-detect a suitable renderer.. This can be fixed with import "@pixi/canvas-renderer";
  2. But there is a follow up error this.app.renderer.context.extensions is undefined

Expected Behavior

Should render with canvas using forceCanvas option.

Steps to Reproduce

https://codesandbox.io/s/heuristic-booth-0pzgbk

Environment

Possible Solution

No response

Additional Information

No response

baseten commented 1 year ago

@Zyie I remember that we had this working, I'm wondering if it's related to non-legacy packages being peerDependencies of @pixi/react?

I'm considering whether we should nuke all pixi packages from peerDependencies and just explicit instruct users to install it alongside pixi-react?

Zyie commented 1 year ago

@Zyie I remember that we had this working, I'm wondering if it's related to non-legacy packages being peerDependencies of @pixi/react?

I'm considering whether we should nuke all pixi packages from peerDependencies and just explicit instruct users to install it alongside pixi-react?

I don't think that is the issue

The pixi legacy packages are just mixins for the normal pixi packages so as long as they are installed and imported then it should work.

pixi.js-legacy will import these mixins so as long as import 'pixi.js-legacy' is called within the project everything should work

Also for this example Filters do not work in pixi-legacy which may be why it is not working

salojoo commented 1 year ago

I removed the filtering, but the error still persist

salojoo commented 1 year ago

Tried updating pixi.js to 7.2.0 and pixi-react to 7.03, but no luck. Adding import 'pixi.js-legacy' doesn't help either

salojoo commented 1 year ago

I'm having trouble building and running the repo locally so didn't manage to create a patch, but the problem seems to be that Pixi v7 deprecated context in favor of canvasContext.

https://pixijs.download/dev/docs/PIXI.CanvasRenderer.html#context

Edit: https://github.com/pixijs/pixi-react/pull/430

Zyie commented 1 year ago

should be fixed in 7.1.0!

thanks for the help @salojoo