Closed lukehorvat closed 10 months ago
I've seen this happen when using webpack. What happens is that the bundler is double-importing both the cjs and module versions of PixiJS when you import pixi.js
instead of using the individual modules. You can change this behavior in the config, but it gets complicated. See this issue for further info: https://github.com/pixijs/pixijs/issues/8467
Thanks for sharing @lunarraid.
I actually faced the exact same problem with three.js
recently too and decided to solve it by updating my tsconfig in favor of ESM. I can't be bothered with any CJS workaround solutions, so I guess I will do the same for pixi.js
.
I'll close this issue then since yours covers it. Cheers.
For someone else encounter this issue with webpack + typescript, try this:
// webpack.config.ts
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
compilerOptions: {
module: 'esnext', // Add this
},
},
},
I am running to the same issue, am using vite and i do not need to set the module to 'esnext'. because it is simply there, and i am getting the same error
I am running to the same issue, am using vite and i do not need to set the module to 'esnext'. because it is simply there, and i am getting the same error
Same here.
Current Behavior
Creating a texture and passing it to a sprite as a prop:
Results in this error:
For some reason,
@pixi/react
andpixi.js
don't share the same instance ofTexture
, causing thisinstanceof
check to fail:https://github.com/pixijs/pixi-react/blob/ab3a672af3f589b4e2cdb24024e534b8145d7942/packages/react/src/utils/props.js#L83
Expected Behavior
The
instanceof
check should not fail.Steps to Reproduce
I made a small repo to allow you to easily reproduce the error: https://github.com/lukehorvat/pixi-react-texture-bug
Environment
@pixi/react
version: 7.1.0pixi.js
version: 7.2.4React
version: 18.2.13ReactDOM
version: 18.2.6Possible Solution
No response
Additional Information
No response