1 min read
Last update: December 19, 2021

Moving to Vite

If you have an existing Vue CLI project it’s relatively straightforward to move over. There are a few things to keep in mind.

Env Variables

Vite exposes env variables on the import.meta.env global. Evan describes how to use this in the video, and you can read more in this documentation.

Require vs Import

When using webpack you might use require calls. In Vite we strongly recommend against require, because it’s technically a node.js concept and it won’t work well with Vite. However, if you’re using a depedency that uses require Vite will handle that.


This is a feature of webpack that allows you to look at the files of a directory at runtime. Vite has an equivalent called Glob Import, which you’ll want to use instead.

Learning More

To learn more about Vite, be sure to check out the documentation, or check out Awesome Vite.js, a curated list of awesome things related to Vite.