Installation
I am currently available for Node, Bun and Deno. Below I will show you how to add me to your project.
General
On this page are examples of individual and wildcard imports. If bundle size is important to you, you should check if your bundler can still split the code if you prefer wildcard imports. In my own testing with esbuild, code splitting worked.
If you are using TypeScript, I recommend that you enable strict mode in your tsconfig.json
so that all types are calculated correctly.
{
"compilerOptions": {
"strict": true
// ...
}
}
From npm
For Node and Bun, you can add me to your project with a single command via your favorite package manager.
npm install valibot # npm
yarn add valibot # yarn
pnpm add valibot # pnpm
bun add valibot # bun
After that you can import me into any JavaScript or TypeScript file.
// With individual imports
import { … } from 'valibot';
// With a wildcard import
import * as v from 'valibot';
From Deno
With Deno, you can reference me directly through my deno.land/x URL.
// With individual imports
import { … } from 'https://deno.land/x/valibot/mod.ts';
// With a wildcard import
import * as v from 'https://deno.land/x/valibot/mod.ts';
The rest of this documentation assumes that you are using npm for the import statements in the code examples.