A Rspack plugin for typia - TypeScript transformer for runtime type checking and validation.
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.
Add the plugin to your rspack.config.js
:
import { TypiaRspackPlugin } from "typia-rspack-plugin";
export default {
plugins: [
new TypiaRspackPlugin(),
],
};
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(),
],
},
},
});
The plugin accepts all options supported by @ryoppippi/unplugin-typia
. For detailed options, please refer to the unplugin-typia
documentation.
Build the library:
pnpm build
Build the library in watch mode:
pnpm dev
MIT License - see the LICENSE file for details.