pixijs icon indicating copy to clipboard operation
pixijs copied to clipboard

[v8] Cannot read property 'addRenderable' of undefined

Open JetLua opened this issue 1 year ago • 4 comments

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.

JetLua avatar Mar 22 '24 15:03 JetLua

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

bigtimebuddy avatar Mar 22 '24 19:03 bigtimebuddy

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.

https://github.com/pixijs/pixijs/blob/d4cb3d10fb8e50be8fc4e41e9d2844831df0a79e/src/scene/container/utils/buildInstructions.ts#L73-L75

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

JetLua avatar Mar 23 '24 04:03 JetLua

thanks for sharing! il take a look

GoodBoyDigital avatar Mar 28 '24 09:03 GoodBoyDigital

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!

GoodBoyDigital avatar Apr 05 '24 10:04 GoodBoyDigital

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

@bigtimebuddy hey, I tried to import pixi.js/unsafe-eval however, I am still getting the following error.

I am using Webpack 5 as bundler, so i have resolution config set as follows:

'pixi.js/unsafe-eval': path.resolve(__dirname, './node_modules/pixi.js/lib/unsafe-eval/init.js'),

then in the app code:

import 'pixi.js/unsafe-eval';
import { Container, Application, Ticker, Graphics } from 'pixi.js';
import * as PIXI from 'pixi.js';

also tried

import { Container, Application, Ticker, Graphics } from 'pixi.js';
import * as PIXI from 'pixi.js';
import 'pixi.js/unsafe-eval';

any clue, why it's still throwing error? Screenshot 2024-05-20 at 9 12 20 PM

Thank you

kencanak avatar May 20 '24 13:05 kencanak

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

@bigtimebuddy hey, I tried to import pixi.js/unsafe-eval however, I am still getting the following error.

I am using Webpack 5 as bundler, so i have resolution config set as follows:

'pixi.js/unsafe-eval': path.resolve(__dirname, './node_modules/pixi.js/lib/unsafe-eval/init.js'),

then in the app code:

import 'pixi.js/unsafe-eval';
import { Container, Application, Ticker, Graphics } from 'pixi.js';
import * as PIXI from 'pixi.js';

also tried

import { Container, Application, Ticker, Graphics } from 'pixi.js';
import * as PIXI from 'pixi.js';
import 'pixi.js/unsafe-eval';

any clue, why it's still throwing error? Screenshot 2024-05-20 at 9 12 20 PM

Thank you

apologise, please ignore my question. i did a stupid mistake.

kencanak avatar May 21 '24 02:05 kencanak