Using require () in a remote node -webkit application

I have a package.json file that looks like this:

{
    "name": "title",
    "description": "description",
    "version": "0.1",
    "main": "https://path-to-application/",
    "window": {
        "show": true,
        "toolbar": false,
        "frame": true,
        "position": "center",
        "width": 800,
        "height": 600,
        "min_width": 220,
        "min_height": 220
    }
}

But when I try to run the code:

var GUI = null;
var win = null;
try { GUI = require('nw.gui'); win = GUI.Window.get(); } catch (ex) { }
win.toggleFullscreen();

Nothing happens, adding warnings for the GUI and winning show that both are set to zero. When I run the same code from the index.html file in the same .zip as package.json, it works as expected. With the initial call, request () does not seem to work.

Is there a way to get this to work in a remotely hosted application?

+5
source share
1 answer

I managed to solve this problem by adding node-remote to the package.json file if someone else runs into this problem.

+6
source

All Articles