Node.js dependencies with NPM/YARN in RPGMV

ITGuy9401

Yet Another Guy From The IT Dept.
Member
Joined
Sep 3, 2018
Messages
5
Reaction score
3
First Language
Italian
Primarily Uses
RMMV
Hi everyone!
I've noticed that in the project directory of my game, there is a package.json.
Is it possible to install dependencies through NPM or YARN?

I'm working on making a Google Firebase integration with the project, for cloud save-files, secure OAuth login and even fetching and pushing data from/to the firebase's real-time database.
 

LTN Games

Indie Studio
Veteran
Joined
Jun 25, 2015
Messages
704
Reaction score
631
First Language
English
Primarily Uses
RMMV
I don't see why not, but I wouldn't bother with using the projects package.json. You're better off starting your Firebase integration in a separate folder and create plugins that you move over to any project you create. My project structure is always like this

upload_2018-9-2_17-57-55.png

where the game folder is the MV project and my plugin or whatever I'm working on is in the src folder and then the build process will move it to the game plugin directory.
 
Last edited:

ITGuy9401

Yet Another Guy From The IT Dept.
Member
Joined
Sep 3, 2018
Messages
5
Reaction score
3
First Language
Italian
Primarily Uses
RMMV
I don't see why not, but I wouldn't bother with using the projects package.json. You're better off starting your Firebase integration in a separate folder and create plugins that you move over to any project you create. My project structure is always like this

View attachment 97543

where the game folder is the MV project and my plugin or whatever I'm working on is in the src folder and then the build process will move it to the game plugin directory.
Since the WEB SDK Guide tells do import some <script> tags in your index, I ended up, for avoiding to use too much the "tariff plan" on the user's device, I've ended up downloading the scripts, such as firebase-app.js and firebase-auth.js in the plugin directory, and refer them as plugins. Now it works flawlessly.

I had problems using the firebase SDK available through NPM since there was a problem building gRPC with nw-gyp...

Hope that this answer can help anybody!
 

ITGuy9401

Yet Another Guy From The IT Dept.
Member
Joined
Sep 3, 2018
Messages
5
Reaction score
3
First Language
Italian
Primarily Uses
RMMV
After some tests, I figured out that there is a bug in Firebase js SDK, and it does not work with NW.js, which is at the base of RPGMaker MV as I can see.
 

LTN Games

Indie Studio
Veteran
Joined
Jun 25, 2015
Messages
704
Reaction score
631
First Language
English
Primarily Uses
RMMV
If you are doing this for yourself maybe give electron a try. I personally use electron for all my projects outside MV. https://electronjs.org
 

EmbarassingMan

Villager
Member
Joined
Sep 5, 2018
Messages
13
Reaction score
2
First Language
italian
Primarily Uses
RMMV
Thanks LTN, that was very interesting... I'm still confused though about how you do that. When I compile my ES6 and move it into the plugin folder, there is still plenty of things that RMMV won't like, in particular the require statements won't find anything.

Is there some tutorial or such around?

Thanks
 

LTN Games

Indie Studio
Veteran
Joined
Jun 25, 2015
Messages
704
Reaction score
631
First Language
English
Primarily Uses
RMMV
If you're correctly bundling your plugin files then the require statement should be non-existent after it's been completed. A bundler is responsible for gather the necessary code from all modules/packages including the code that the require statement or import statement are referencing. What bundler are you using? The more I know about your project and what you're trying to do with what packages then I can help you further.

On a side note today I'm just about finished my latest release to FeniXCLI 0.3.0, which auto configures and install packages required for a module based plugin development environment, it's powered by RollupJS(the bundler). I'm not quite finished yet but I can let you know when I'm done.

In the meantime you could take a look at my example project on how to get FeniXTools working which should not be very different from what you're trying to do. It uses RollupJS as the bundler, without the use of FeniXCLI so it's basically a default project to learn from https://gitlab.com/FeniXEngineMV/fenix-tools-example

Feel free to PM me any questions that don't seem to fit in this topic
 

EmbarassingMan

Villager
Member
Joined
Sep 5, 2018
Messages
13
Reaction score
2
First Language
italian
Primarily Uses
RMMV
Thanks a lot, this really answers my question: I simply did not know I needed a bundler (which is evidently essential to use any NPM dependency, so we are still on-topic I guess).

I'll surely give a try at your tool, it looks pretty cool :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,972
Members
137,561
Latest member
JaCrispy85
Top