DEV Community

Discussion on: Building a Desktop App with Vue: NW.js

Collapse
 
leshgan profile image
Leshgan

Compiled app works only when npm run serve running. How to fix that?

Collapse
 
n_tepluhina profile image
Natalia Tepluhina

You will need to take following steps:

1) add vue.config.js file with the following content:

module.exports = {
  publicPath: '.',
};

(if you use vue-cli below 3.3.0, replace publicPath with baseUrl)

2) build the project with yarn build;
3) change main in package.json to

"main": "index.html"

4) copy package.json to dist
5) run ./node_modules/.bin/build --tasks mac-x64 dist (assuming you're on OSX)

You will have your app in dist/dist folder

Collapse
 
mdashrafulpramanik profile image
Md-Ashraful-pramanik

This works but we can find the source file under js folder. If NW.js keep source file then why I'am use it? It will be better to use Electron. Please tell me if there is a way to build a desktop app with compiled source code from vue.

Collapse
 
aldisseia profile image
aldisseia

Is not working...

Add file vue.config.js in root, make command:
npm run nw-serve
compiled app works, more vue is not work