Introduction
Introduction
unplugin-scriptc runs scriptc inside your bundler pipeline through the unplugin factory, so the same plugin works with Vite, Rollup, Webpack, esbuild, and Rolldown.
It does one thing: run scriptc build on your app entry during the build and surface scriptc coverage diagnostics through the bundler’s warning channel. It does not analyze code itself; every reported problem comes from the compiler.
Install
npm i -D unplugin-scriptc scriptc
pnpm add -D unplugin-scriptc scriptc
bun add -D unplugin-scriptc scriptc
scriptc is a peer dependency pinned to ^0.3.0: it accepts any 0.3.x release, so patch and bug-fix releases flow through without a plugin bump, but the next minor (0.4.0) is an explicit upgrade. The plugin only relies on the scriptc build flag surface and the v1 diagnostics JSON envelope, both stable within the 0.3 line.
Usage
// vite.config.ts
import { defineConfig } from "vite";
import { scriptcPlugin } from "unplugin-scriptc";
export default defineConfig({
plugins: [
scriptcPlugin.vite({
entry: "src/main.ts",
out: "dist/app",
optimization: "speed",
}),
],
});
// rollup.config.mjs
import { scriptcPlugin } from "unplugin-scriptc";
export default {
plugins: [scriptcPlugin.rollup({ entry: "src/main.ts" })],
};
// esbuild.config.mjs
import { scriptcPlugin } from "unplugin-scriptc";
export default {
plugins: [scriptcPlugin.esbuild({ entry: "src/main.ts" })],
};
// webpack.config.mjs
import { scriptcPlugin } from "unplugin-scriptc";
export default {
plugins: [scriptcPlugin.webpack({ entry: "src/main.ts" })],
};
What a build does
buildStart:scriptc coverage <entry> --print diagnosticsruns and each blocker group is reported with its file and line. A build with blockers fails by default (failOnBlockers).closeBundle(defaultrunOn):scriptc buildcompiles the entry to native output at--out(or.scriptc/<name>).
entry can be omitted when the bundler names one: vite build.ssr, build.lib.entry, build.rollupOptions.input, or the rollup-family input.