typia-rspack-plugin
v2.2.2
Published
A plugin for Rspack to use Typia.
Readme
typia-rspack-plugin
A Rspack plugin for typia - TypeScript transformer for runtime type checking and validation.
Why
This plugin is a lightweight alternative to using the full unplugin-typia package. While unplugin-typia supports multiple bundlers (Webpack, Vite, Rollup, etc.), this plugin is specifically designed for Rspack users. By only including the Rspack-specific code, we can significantly reduce the installation size and dependencies.
If you're using Rspack as your bundler and typia for runtime type checking, this plugin provides the same functionality as unplugin-typia but with a smaller footprint.
Usage
Add the plugin to your rspack.config.js:
import { TypiaRspackPlugin } from "typia-rspack-plugin";
export default {
plugins: [
new TypiaRspackPlugin(),
],
};Using with Rslib
If you're using Rslib, you can add the plugin to your rslib.config.ts:
import { defineConfig } from "@rslib/core";
import { TypiaRspackPlugin } from "typia-rspack-plugin";
export default defineConfig({
lib: [
{ format: "esm" },
],
tools: {
rspack: {
plugins: [
new TypiaRspackPlugin(),
],
},
},
});Options
The plugin accepts all options supported by @ryoppippi/unplugin-typia. For detailed options, please refer to the unplugin-typia documentation.
Development
Build the library:
pnpm buildBuild the library in watch mode:
pnpm devLicense
MIT License - see the LICENSE file for details.
