javascript.vite
import { javascript } from "https://garn.io/ts/v0.0.16/mod.ts";
const { vite } = javascript;Plugin for vite projects. This will add to your
Project:
- a
Packagecalledbuildthat will bundle your vite project, - an
Executablecalleddevthat will run your dev server, - an
Executablecalledpreviewthat 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.16/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;
}>;