Help understanding the mechanics


I was reminded of glitch again today, and wondered if I could use vuejs with a project. The answer seems to be yes, but I don’t understand why. I see this example:!/vuejs-template , and it works for me, but I’m confused with the reference to server.js (in package.json) that appears to not exist, and that the .vue file is being processed at all. I would appreciate any help with what is actually going on under the hood.


Hi @ckhrysze,

you can always try to remix the example app and make changes, to figure out what’s going on :slight_smile: anyway! In this particular case, package.json specifies a main field, but it is not used at all, so it can be removed. This solves the “server.js” mystery, right? :slight_smile:

Everything else works in this way:

  1. package.json specifies the dependencies of the application, and you see pushstate-server listed. You can find in npm that pushstate-server is simply a webserver.

  2. package.json specifies the start script, it’s the script that is run to start the application. You can see that it is set to pushstate-server: so the application is a webserver!

  3. When you click Show, the webapp is opened in a new tab of your browser, and since it is a webserver, it loads index.html, which references index.js, which loads app.vue :slight_smile:

If something is still not clear, let us know! :slight_smile:


Thank you for the quick response! Glad to know I wasn’t crazy regarding the server.js file. The pushstate-server makes sense, what I was truly missing seems to be and how it does way more than I’d have thought a single library might do.