Node.js dependencies with NPM/YARN in RPGMV

● ARCHIVED · READ-ONLY
Started by ITGuy9401 8 posts View original ↗
  1. 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.
  2. 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.
  3. LTN Games said:
    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!
  4. 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.
  5. 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
  6. 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
  7. 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
  8. 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 :)