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


#1

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


#2

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?


#3

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:


#4

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


#5

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:


#6

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.


#7

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


#8

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


#9

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…


#10

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


#11

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';


#12

@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:


#13

@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.


#14

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


#15

@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.