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: https://glitch.com/edit/#!/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 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?
Everything else works in this way:
-
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. -
package.json specifies the
start
script, it’s the script that is run to start the application. You can see that it is set topushstate-server
: so the application is a webserver! -
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
If something is still not clear, let us know!
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 https://www.npmjs.com/package/getlibs and how it does way more than I’d have thought a single library might do.