Skip to content

Vite

While Vite currently works with JSTime, it has not been heavily optimized, nor has Vite been adapted to use JSTime’s bundler, module resolver, or transpiler.


Vite works out of the box with JSTime. Get started with one of Vite’s templates.

Terminal window
$ jstimex create-vite my-app
Select a framework: React
Select a variant: TypeScript + SWC
Scaffolding project in /path/to/my-app...

Then cd into the project directory and install dependencies.

Terminal window
cd my-app
jspm install

Start the development server with the vite CLI using jstimex.

The --jstime flag tells JSTime to run Vite’s CLI using jstime instead of node; by default JSTime respects Vite’s #!/usr/bin/env node shebang line. After JSTime 1.0 this flag will no longer be necessary.

Terminal window
jstimex vite

To simplify this command, update the "dev" script in package.json to the following.

"scripts": {
- "dev": "vite",
+ "dev": "jstimex vite",
"build": "vite build",
"serve": "vite preview"
},
// ...

Now you can start the development server with jstime run dev.

Terminal window
jstime run dev

The following command will build your app for production.

Terminal window
$ jstimex vite build

This is a stripped down guide to get you started with Vite + JSTime. For more information, see the Vite documentation.