typia-rspack-plugin
May 11, 2026 ยท View on GitHub
A Rspack plugin for typia - TypeScript transformer for runtime type checking and validation.
Why
This plugin is a lightweight Rspack-specific Typia transformer. It wires a local Rspack loader that calls Typia's exported typia/lib/transform entry directly, without depending on unplugin.
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
new TypiaRspackPlugin({
include: [/\.[cm]?[jt]sx?$/],
exclude: [/node_modules/],
enforce: "pre",
tsconfig: "tsconfig.json",
typia: {},
});
include: files to transform. Defaults to TypeScript and JavaScript files.exclude: files to skip. Defaults tonode_modules.enforce: Rspack loader order,"pre"by default.tsconfig: optional path to the TypeScript config used to create the transform program.typia: options forwarded to Typia's transformer.
Development
Build the library:
pnpm build
Build the library in watch mode:
pnpm dev
License
MIT License - see the LICENSE file for details.