Introduction
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
pnpm
bun
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. scriptc evolves fast and changes flags between releases, so the pin is deliberate; upgrade it when you are ready to re-check your build flags.
Usage
Vite
Rollup
esbuild
Webpack
// 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.