NW.js (node-webkit) and Vue.js issue with require systeminformation module

528 views Asked by At

I have a project that uses NW.js in conjunction with Vue.js. The problem is that I can't include systeminformation module to the Vue.js because according to the documentation (see the core concept section) this lib doesn't work from inside the chromium but only on a server-side. How to include this lib in nw.js to make it available globally so I can use it from inside the vue code?

I've been using a solution that seemed to work but recently I figured out that it isn't. What I've been doing - I included script right in the ./public/index.html and it works on dev but not on the build. When I build the app and move it to another place it just can't find the path to the systeminformation package.

<!-- inside index.html -->

<script>
  const si = require("systeminformation");
</script>

Any idea how to overcome this? Would be much appreciated. Thank you.

1

There are 1 answers

5
Jaredcheeda On BEST ANSWER

It depends on the way you are using Vue. If you are doing a simple "CDN" style then look at this example:

The README in that repo will give step-by-step instructions.

If you are using the Vue-CLI style, then this should work:

That repo is a complete boilerplate for Vue-CLI + NW.js