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

Crashes with "Unrecognized source type to auto-detect resource" when imported in NodeJS #199

Open
patreeceeo opened this issue Feb 16, 2024 · 6 comments

Comments

@patreeceeo
Copy link

Steps to reproduce

  1. start node interactive shell
  2. import("pixi3d/pixi7")

Stack trace

Uncaught Error: Unrecognized source type to auto-detect Resource
    at autoDetectResource (file:///.../node_modules/@pixi/core/lib/textures/resources/autoDetectResource.mjs:15:9)
    at new _BaseTexture2 (file:///.../node_modules/@pixi/core/lib/textures/BaseTexture.mjs:46:64)
    at Texture.from (file:///.../node_modules/@pixi/core/lib/textures/Texture.mjs:125:155)

What I expected

It can be imported in Node without crashing. What I've read on in this project's discussions leads me to believe this should be possible.

@jnsmalm
Copy link
Owner

jnsmalm commented Feb 19, 2024

Why do you want to do this in an interactive shell?

@patreeceeo
Copy link
Author

In my case, for automated testing.

@patreeceeo
Copy link
Author

To clarify, the issue isn't only in the Node CLI/interactive shell. It's in any Node context. Besides automated tests, library users may want to SSR.

@patreeceeo
Copy link
Author

I think the argument could also be made it's a general usability issue when a module is written such that it assumes and creates a hard dependency on a certain environment at import time?

@jnsmalm
Copy link
Owner

jnsmalm commented Feb 21, 2024

In general, Pixi3D has not been created to be imported in any environment. If you want to dig deeper and provide a solution I'm happy to accept a PR.

@jnsmalm
Copy link
Owner

jnsmalm commented Feb 21, 2024

Btw, Pixi3D itself has automated tests. Maybe you can have a look at those and see how it works?

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

2 participants