[Vuejs]-Vue.js + Node.js: Where is Server Config

0👍

The webpack template comes with a webpack-dev-server (Node.js based) already prepared for the history mode: there is no need to edit any config while you are developing your app via npm run dev.

You have to apply the server configuration shown in the docs when you are deploying your app via npm run build, that will create a /dist folder which content you are free to upload to any static server (not necessarily Node.js).

The example code is the main script of a Node.js server, but it’s pretty much bare-bones, it returns the content of index.html (there is also a “typo” in the code, should be .html not .html) to any request, but that breaks any other asset requests like CSS or JS. It’s for demostrative purposes only: respond to any route (URL) with index.html.

If you plan to deploy into a Node.js server you should look for a better script.

Leave a comment