Comments (22)
//assets.ts
import manifest from "./manifest.json";
import { Assets } from "pixi.js";
.
.
.
export async function initAssets() {
await Assets.init({ manifest });
const assets = await Assets.loadBundle(["fonts", "default", "sounds", "shop"]);
.
.
.
}
from pixijs.
This is the code likely where this is happening:
pixijs/packages/assets/src/resolver/Resolver.ts
Lines 651 to 656 in abecc35
There are other ways we could write this which would exclude things on the prototype.
from pixijs.
I mean, Object.freeze(Object.prototype)
before window.fbAsyncInit = function() { ...
from pixijs.
@bigtimebuddy Perhaps we could consider adding guard-for-in
to our @pixi/eslint-config
?
https://github.com/pixijs/eslint-config/blob/0bc65621ec0fc2e477f1c060ceb6a94b8975e5ac/index.js#L66
from pixijs.
Nice, both of them solved the issue, I can use these for quick fix.
from pixijs.
Can you show how you import and use PixiJS? It would be nice if you could provide a full stack trace of the errors.
from pixijs.
I logged the paths, they may help you.
from pixijs.
If I remove Facebook SDK from index.html, undefined consoles disappear that above picture.
from pixijs.
Maybe try debugging at the promises
call in the stack. See what the assetsToLoad
looks like.
from pixijs.
Here it is;
from pixijs.
I also need to mention that sometimes it doesn't give the error in Chrome, and the application opens, but it always gives the error in Firefox.
from pixijs.
Looks like the Facebook SDK injected the array somewhere 🤔
from pixijs.
Wow, that is wild. I agree that it sounds like some prototype stuffing via Facebook SDK.
If you can track down where in Assets those extra keys are added, it might give us a clue. If you do console.log([], Array.prototype, {}, Object.prototype)
and see if that has getParams, getConfig, etc? Can you repro this outside Pixi?
from pixijs.
these?
from pixijs.
I don't think that I can reproduce this issue outside of Pixi. On the other hand, I run it under the Facebook URL as a localhost. I mean the url is like:
from pixijs.
That's super annoying on Facebook's part.
One idea is that we might want to use Object.create(null)
instead of {}
which would remove any prototype-chain and insulate us from this issue. There are a bunch of areas in Assets that do this type of assignment. For example:
pixijs/packages/assets/src/Assets.ts
Line 556 in abecc35
from pixijs.
As a workaround, maybe you can try to Object.freeze(Object.prototype)
before everything?
from pixijs.
For instance, Object.getOwnPropertyNames(results)
would give us more stable results.
from pixijs.
I have both tried Object.create(null)
and Object.freeze(Object.prototype)
. The error appears in both cases.
from pixijs.
@bigtimebuddy I tried your last suggestion:
and I got a different error
from pixijs.
@SuperSodaSea in your case: Object.freeze(Object.prototype)
before window.fbAsyncInit = function() { ...
I get TypeErrors:
from pixijs.
What about Object.seal(Object.prototype)
or Object.preventExtensions(Object.prototype)
?
from pixijs.
Related Issues (20)
- Bug: v8.0.0-rc4 Texture.update() missing? HOT 3
- Bug: Moving a DisplayObject to a different Container prevents the mouseout event from working reliably
- Bug: Incorrect calculation of vTextureCoord when scaling parent container HOT 1
- Bug: pointerover/pointerout fire twice when eventMode HOT 11
- Bug: BitmapText multiline and missing characters
- Bug: v8.0.0-rc.5 Culled containers are culled forever HOT 4
- Bug: Pixi 8 build with vite get warning and pixi crashes when minify is turned on HOT 2
- Bug: 8.0.0-rc.5 no longer renders sprites on Firefox HOT 2
- Bug: in docs, example for PIXI.Geometry draws a dovetail instead of a square HOT 2
- Bug: v8.0.0-rc.6 Texture.update() not working as expected
- Bug: Transparent Background doesn't work HOT 2
- Bug: When curve the text, the bounds of the text get cut off in pixijs 4.8.9 HOT 1
- Bug: Adding fill to certain Graphics with reversed normals causes lineStyle stroke to reverse inner/outer position
- Bug: 'Worker is not defined' with Pixi 7.4.0 and Node v18.17.1 HOT 15
- Bug: Incorrect Text color
- Bug: v8.0.0-rc.7 Calling Texture.update() causes texture rendering to fail HOT 2
- Bug: v8.0.0-rc.7 Exception when rendering odd-sided polygon after even-sided polygon
- Feature Request: Add Multi-Touch events HOT 4
- Bug: v8.0.0-rc.7 Canvas texture conflicts with Graphics when WebGL is used HOT 3
- Bug: v8.0.0-rc.7 iterating into a container and using removeChild causes object to to not be rendered
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixijs.