The project uses rolldown to bundle the VSCode extension client. The configuration targets a Node.js platform, uses CommonJS (cjs) format, and treats vscode as an external dependency.
Key configuration details:
- Input:
client/src/extension.ts - Output File:
dist/extension.js - External Dependencies:
vscode must be marked as external to prevent bundling the VSCode API. - Environment-based behavior:
- If
NODE_ENV is production, the output is minified and sourcemaps are disabled. - If
NODE_ENV is not production, sourcemaps are enabled and minification is disabled.
- Plugins: A
problem-matcher plugin is conditionally included during watch mode to log build start and finish events.
import { defineConfig } from "rolldown";
const production = process.env.NODE_ENV === "production";
const problemMatcherPlugin = {
name: "problem-matcher",
buildStart() {
console.log("[watch] build started");
},
buildEnd() {
console.log("[watch] build finished");
},
};
export default defineConfig(({ watch }) => ({
input: "client/src/extension.ts",
platform: "node",
external: ["vscode"],
plugins: [watch && problemMatcherPlugin].filter(Boolean),
output: {
file: "dist/extension.js",
format: "cjs",
sourcemap: !production,
minify: production,
},
}));