Anyone has an actual solution to https://forums.rpgmakerweb.com/index.php?threads/referenceerror-require-is-not-defined.61527 ? I never found what specifically causes it, and it almost seems random as sometimes some random browser loads it...
"ReferenceError require is not defined"
RPG Maker MZ Support"require" is a NodeJS command to load a library. In a nutshell, NodeJS is an environment that runs JS as a desktop app when not running in the browser. Hence, "require" does not work when playing as a browser game.
From my experience, In the RPG Maker world, this error is usually a mistake by the developer. It is often used to import "fs" (filesystem) to read and write data while the developer forgets that we already have Storage and Data Manager.
Because of this, there is no simple solution to it. You would need to ask the developer to fix their code and remove or replace the "require" command.
If the Plugin is small, I could take a look at it, and maybe I can fix it for you.
From my experience, In the RPG Maker world, this error is usually a mistake by the developer. It is often used to import "fs" (filesystem) to read and write data while the developer forgets that we already have Storage and Data Manager.
Because of this, there is no simple solution to it. You would need to ask the developer to fix their code and remove or replace the "require" command.
If the Plugin is small, I could take a look at it, and maybe I can fix it for you.
I don't know which plugin it is...
Can you press F12 or right-click -> "investigate" to open the dev console? There is a console tab. Please screenshot everything that you can see there.
What am I looking for in the inspector?
It looks like this:
We need to see everything on the right
We need to see everything on the right
I think it's fossil...
These seem to be the lines referenced:
xhr.onload = () => this.onXhrLoad(xhr, name, src, url);
writeNewIndexFile(window[name], 'text/html');
var fs = require("fs");
xhr.onload = () => this.onXhrLoad(xhr, name, src, url);
writeNewIndexFile(window[name], 'text/html');
var fs = require("fs");
Fossil is not maintained anymore and I need to say, this plugin is not a technical masterpiece at all. Maybe you find someone who already dealt with Fossil, but for me, it would take me a few hours until I would have fixed this issue. Sorry.
A few hours is too much?
I guess I used the wrong wording, it's not "a few hours" but more like "a couple of hours". I suggest asking in the thread directly https://forums.rpgmakerweb.com/inde...-plugins-in-mz-300-plugins-fossilized.135523/ why FOSSIL tries to use filesystem and how to avoid that when in web browser mode.
I personally will not touch FOSSIL nor write patches for it, it's not worth it.
I personally will not touch FOSSIL nor write patches for it, it's not worth it.
To get FOSSIL to work with web deployment, you need to follow this instruction (from the original post in the main FOSSIL thread):
This really is something the developer should have made better - and which makes me distance myself from this plugin.
To ask for someone else to volunteer to help a random person? I would say yes.
I try to be helpful and toss out a lot of free code and fixes and such, but if I find I'm doing something that's pushing 15 minutes, unless I think it'll help a lot of people or I'm personally interested, I'll call it off.
And every person here will have their own personal gauge for how much they're willing to donate to a specific issue...but yes, I think asking someone else to give you a few hours is too much. There's the commissions forum.
Commissions for someone else's script, though... or maybe MZ should have had built-in compatibilities...
It's the nature of things that code may break after a major iteration of an engine. I'm a professional programmer, I know what I'm talking about.
Yeah, but my impression is that they keep releasing versions with very few actual additions, and perhaps end up breaking (MV plugins here) more than the amount of features they add.
I don't see how that's pertinent. Work is work. Yours would not be the first post in the commissions forum to hire someone to do a job on an existing plugin from another author.
That's not how software works. Even professional studio games will release updates that break compatibility with existing saves and community mods. The priority, logically enough, has to be with making improvements to their actual code that is their product.
As long as the plugin author does not prohibit changes to their plugin, you can commission someone to do it. If it's a paid plugin it's a bit more complicated, but fossil is not paid.
Original thread: https://forums.rpgmakerweb.com/threads/referenceerror-require-is-not-defined.157130/