Requiring a user module from the renderer process


#1

So the structure of my project currently looks like this:

Root
    main.js
    module.js
    ...
    gui-src
        js
            script.js
            test.js
        css
            ...
        ...

I want to import module.js into script.js (script.js is part of the renderer process). I try to do so using require('../../module') but I keep getting errors. What’s weird is even if I try to load require('./test'), I get errors from there too! require.main.require() doesn’t give me much luck either…

I then tried loading test.js from main.js using require('./gui-src/js/test') and that worked, and in test.js I added a line that does require('../../module') and that worked too! So importing a module from two directories up worked from the main process but not the renderer process it seems.

So do electron projects work differently than normal node projects regarding require? Or did I just mess up with path names somewhere?