DEV Community

loading...

Holy shit NW.js is so easy

The Jared Wilcurt
Cross-Platform Desktop App (XPDA) Engineer, Senior Frontend Web Developer. Maintainer of Scout-App. Editor of XPDA.net.
・2 min read

Okay, so like.... you ready for this. Don't blink

1. Make an HTML5 file, it can even just be an empty file, called index.html
2. Make a package.json, you only need these 3 lines:

{
  "name": "my-first-desktop-app",
  "main": "index.html",
  "scripts": { "start": "nw" }
}

3. npm install --save-dev nw@sdk && npm start

That's it. You just made a desktop app. 🎉 🎊 ✨

Seriously, that was it. 2 files, 3 lines of code, and like 1-ish? maybe that's two commands? I don't know, it's freaking easy though.

Time yourself, see if you can do it in under 60 seconds. Post your times below. Always speedrun your hello worlds.


Oh, and you can also just do any Node stuff from the DOM directly. And the nw api is pretty easy-peasy.

<!DOCTYPE html>
<html>
  <head>
    <title>My first desktop app</title>
  </head>
  <body>
    <script>
      const fs = require('fs');
      console.log(fs.readdirSync('.'));
      nw.Window.get().showDevTools();
    </script>
  </body>
</html>

The Node and Chromium version it comes with is always the latest. Gets updated within 24 hours of a new release of either. So, you probably don't need Babel.


"But the filesize is gigantic?"

I gotchu homie


Any other downsides I should know about?

Why you gotta be so negative, can't you just be happy for me


For a more in-depth and beginner friendly tutorial on NW.js:

Discussion (0)