Kokodoko
Kokodoko

Reputation: 28148

NWJS SDK is not using package.json

I am using NWJS to create a desktop app. The package.json file determines the settings. This works fine, but only in the distribution version.

{
  "name": "My NWJS project",
  "main": "index.html",
  "window": {
    "title": "Testing NWJS",
    "kiosk": false,
    "toolbar": true,
    "frame": true,
    "no-edit-menu":false
  }
}

Now I want to debug with F12 (browser inspector), so I have to use the SDK version of NWJS. Problem: This SDK version ignores the package.json file. NWJS just opens with a generic window showing the version number.

nw.js v0.35.0 Node v11.3.0 Chromium 71.0.3578.80

If I drag and drop the desired HTML file into the NWJS window, the app won't load at all because AJAX requests aren't allowed in a file context. (the same as when you open the HTML file by double-clicking on it in the finder).

There is no explanation to be found on the 'debugging with devtools' page.

Upvotes: 1

Views: 651

Answers (1)

null
null

Reputation: 1197

You can execute your app from the commandline. I'm on a mac, so (if I'm in the root directory of nwjs) I can run:

nwjs.app/Contents/MacOS/nwjs .

The docs are here: http://docs.nwjs.io/en/latest/For%20Users/Getting%20Started/#getting-started-with-nwjs

Based on what it says there, on windows you should be able to do:

nw.exe .

I have no idea why it doesn't work the same as the normal / non-sdk version, where you can just double click. However, this does work, so you can access debug features.

Upvotes: 0

Related Questions