Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.


what is vite ?

are you tired of reloading the browser page after each and every single change in your sources ?
vite is what you’re looking for ...

with vite:

so, no more back and forth switching between applications; is that cool or what ?


how it works

no file:/// URL

for that to work, you can no longer open in your browser a file URL like file:///Users/jeanmineur/the-webc-course/cv.html

how to open a file then ?

the way it’s going to work with vite is:

and that’s it !
from then on, any change done in cv.html will automatically refresh in the browser


basic install

we’re going to use vite through a tool named npx; this tool will let us run vite without the need for any prior installation

however, we still need .. to install npx of course; fortunately it all boil down to installing node.js
just like a Python install comes with pip, node will come with npm and npx


installing node and npx




how to use it ?

with most of the activities / exercises contained in this course, you will just need to run (in the right folder of course)

npx vite

which as part of its display will show a line like

  ➜  Local:   http://localhost:5173/

and now, you know which port number to use; read on though...


caveats


conclusion

there are many additional features in vite, like vite build, but that’s totally optional

if you’re serious about web development, using vite in development mode is a lifechanging experience, totally worth the small amount of time required to get used to it ;)