Requiring unknown module "pixi.js". NPM is available in Snack?

Hi, I’m working on a snack trying to use pixijs with GLView, however I have an error that says:

Requiring unknown module “pixi.js”.

The snack tries:

import * as PIXI from 'pixi.js';

How can I import pixi.js? I have tried also do local import but the app becomes unresponsable…

Thanks in advance

OK, seems that only a few libraries are available.

Which is the best way to proceed now? I mean, how can I add pixi.js to my Snack?

The message you cited is a bit outdated. We’ve made a lot of progress getting arbitrary modules working in snack, but still don’t have everything covered. It looks like pixi.js still needs some work :confused:

Thanks for the response.
Which kind of work? May I help?

Just letting us know what isn’t working is extremely helpful!
Unfortunately fixing these npm issues involves a lot of context on a couple different projects and we aren’t in a place to ramp up new folks yet, but thanks for the offer :slight_smile:

1 Like

Depending on what you’re looking to do, it might make sense to create a full Expo project and try pixi there. I believe it won’t work 100% out of the box but is possible to get working with some custom patching if you poke around through its internals.

1 Like

If you go that route, https://github.com/EvanBacon/react-native-pixi may help

1 Like

Currently you can run the graphics portion of pixi.js in expo: Source Code.
There are some minor issues holding back the sprite rendering but these are on our radar and we are working to get these fixed! :slight_smile: :blue_heart: Here is an example of importing pixi.js into snack: https://snack.expo.io/@bacon/base-pixi.js

1 Like

Hi Bacon,

thanks for the response.I have the same issue as before.
Requiring unknown module “pixie.js”

I have seen your project react-native-pixi and I was using it as a template for a simpler test of pixie. However the results are the same…

@bacon did you have a chance to see that your snack is not working either?

Yes, I’m aware. That snack is a minimum example of rendering a sprite in pixi.js which currently doesn’t work! :frowning: As a side note, if you are getting this error: Requiring unknown module “pixie.js” it is probably because you mean to import pixi.js like this: import * as PIXI from 'pixi.js';

1 Like

@davidgortega I added a pixi.js basic example to our ‘native-component-list’ example app in this commit: https://github.com/expo/native-component-list/commit/58f9b8f08e61bb1669bcbda27f4fbc8851b2fd6b Note that you will also want to install ‘url’ and ‘path’ as dependencies from npm. For now maybe you could try making a project with exp or XDE rather than Snack. This example doesn’t do sprite rendering yet. I’m working on testing whether sprite rendering works at the moment and fixing it if it doesn’t.

Also @bacon I think they made the ‘pixie.js’ typo in the forum message but in the screenshot the error is actually with ‘pixi.js’ :open_mouth:

1 Like

@nikki you are right, the typo is just in the forum, the screenshot is in fact @bacon 's example running in my browser with the same issue that I had in my own which is very simmilar to his.

'react-native-card-view ’ not supported by the expo.snack
what should i do ?

@abhinav123 react-native-cardview depends on native code, which means it is not compatible with Snack. You can create a bare React Native project (react-native init) or create an Expo project and detach to ExpoKit, and then follow the instructions on that repo.