pixijs: Bug: Facebook Sdk Initialization Error
Current Behavior
When try to add script like
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v18.0'
});
};
</script>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
I got error:
Uncaught (in promise) TypeError: Path must be a string. Received undefined
from @pixi/utils/lib/path.mjs
Expected Behavior
I don’t think that this is because Facebook API, because this API is used commonly over the world.
Steps to Reproduce
Just do instruction from the link
If I download this script and import it manually I got same error, why pixi throws error for an external script?
Environment
pixi.jsversion: 7.2.4*- Browser & Version: Chrome, Firefox
- OS & Version: Windows 11
Possible Solution
No response
Additional Information
No response
About this issue
- Original URL
- State: open
- Created 6 months ago
- Comments: 22 (22 by maintainers)
Nice, both of them solved the issue, I can use these for quick fix.
@bigtimebuddy Perhaps we could consider adding
guard-for-into our@pixi/eslint-config?https://github.com/pixijs/eslint-config/blob/0bc65621ec0fc2e477f1c060ceb6a94b8975e5ac/index.js#L66
I mean,
Object.freeze(Object.prototype)beforewindow.fbAsyncInit = function() { ...This is the code likely where this is happening:
https://github.com/pixijs/pixijs/blob/abecc358a0ce73fc301611ca5c2eecfd3dc7c38f/packages/assets/src/resolver/Resolver.ts#L651-L656
There are other ways we could write this which would exclude things on the prototype.