javascript.vite
import { javascript } from "https://garn.io/ts/v0.0.20/mod.ts";
const { vite } = javascript;
Plugin
for vite projects. This will add to your
Project
:
- a
Package
calledbuild
that will bundle your vite project, - an
Executable
calleddev
that will run your dev server, - an
Executable
calledpreview
that will run a server to preview your production build.
This plugin requires a field node_modules
of type Package
to work.
Usually that is created with garn.javascript.mkNpmProject
.
Here's an example:
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
export const frontend = garn.javascript
.mkNpmProject({
description: "An NPM project",
src: ".",
nodeVersion: "18",
})
.add(garn.javascript.vite);
After running garn run frontend.build
you can then access your built
frontend bundle in ./result
.
const vite: Plugin<{
build: Package;
dev: Executable;
preview: Executable;
}, {node_modules: Package;
}>;