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

[v8] Cannot read property 'addRenderable' of undefined #10366

Open
JetLua opened this issue Mar 22, 2024 · 4 comments
Open

[v8] Cannot read property 'addRenderable' of undefined #10366

JetLua opened this issue Mar 22, 2024 · 4 comments
Assignees

Comments

@JetLua
Copy link
Contributor

JetLua commented Mar 22, 2024

Description

I tried using @pixi/unsafe-eval@7 and pixi.js@8, but I found it doesn't work.

Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.
@bigtimebuddy
Copy link
Member

Try including pixi.js/unsafe-eval. All packages are now shipped with v8.

@JetLua
Copy link
Contributor Author

JetLua commented Mar 23, 2024

Try including pixi.js/unsafe-eval. All packages are now shipped with v8.

@bigtimebuddy Thank you, it's resolved.

When I run the following code in WeChat, I encounter an error.

const renderer = new PIXI.WebGLRenderer()

renderer.init({
  canvas,
  antialias: true,
  preferWebGLVersion: 1,
  backgroundColor: 0x171a24,
}).then(() => {
  const g = new PIXI.Graphics()

  g.fill(0xffc333)
  g.rect(0, 0, 100, 100)

  stage.addChild(g)

  renderer.render({container: stage})
})
Cannot read property 'addRenderable' of undefined

I did some basic research and found that the error stems from the following code snippet. Additionally, I added code locally to print variable information.

const rp = renderPipes as unknown as Record<string, RenderPipe>;
rp[container.renderPipeId].addRenderable(container as Renderable, instructionSet);

console.log(rp)
console.log(container.renderPipeId)

output:

image

I found that there is no graphics property in rp, so rp[container.renderPipeId] is undefined.

I'm not entirely sure if this is a situation unique to WeChat.

@GoodBoyDigital

@GoodBoyDigital
Copy link
Member

thanks for sharing! il take a look

@GoodBoyDigital GoodBoyDigital changed the title Q: [v8] Should release @pixi/unsafe-eval@8? [v8] Cannot read property 'addRenderable' of undefined Apr 3, 2024
@GoodBoyDigital
Copy link
Member

Hey there! The issue is that the extensions are dynamically loaded when via autoDetectRenderer

the quick fix for now would be to do the following:

const renderer = await autoDetectRenderer({
    preference:'webgl'
})

we will look into adding a await createWebGLRenderer() and await createWebGPURenderer() functions that install all the plugins and things!

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

No branches or pull requests

4 participants