Build Overview
View Exports SVG uses different build processes for the extension and the webview client. Understanding these processes is essential for development and deployment.Build Scripts
All build scripts are defined in the rootpackage.json. Here are the key commands:
Development Builds
Production Builds
Extension Build Process
TypeScript Compilation
The extension uses TypeScript with multiple compilation targets:CommonJS Build (Default)
- Uses
tsconfig.cjs.jsonconfiguration - Compiles TypeScript to CommonJS format
- Outputs to
out/cjs/directory - Copies type definitions
- Resolves path aliases with
tsc-alias
tsconfig.cjs.jsonOutput:
out/cjs/Entry Point:
out/cjs/extension.js
ES Module Build
- Uses
tsconfig.esm.jsonconfiguration - Compiles TypeScript to ES Module format
- Outputs to
out/esm/directory
tsconfig.esm.jsonOutput:
out/esm/
Type Declarations Build
.d.ts) for type support.
Configuration: tsconfig.types.jsonOutput:
out/types/
ESBuild Compilation
For optimized production builds, the extension uses esbuild:Standard Extension
esbuild.config.jsFeatures:
- Bundle minification
- Tree shaking
- Source maps (dev only)
- Faster build times
Web Extension
out/cjs/web/extension.jsUse Case: Browser-based VS Code (vscode.dev)
The web extension build includes polyfills for Node.js modules not available in browser environments.
Clean Build
Remove all compiled output before building:out/ directory.
Client Build Process
The webview UI (client) is built separately using Vite:Development Build
- Hot module replacement (HMR)
- Fast refresh
- Development server
- Source maps
Production Build
- Runs TypeScript type checking (
tsc -b) - Builds the React app with Vite
- Optimizes assets
- Outputs to
client/dist/
client/vite.config.tsOutput:
client/dist/Build Tool: Vite (using Rolldown)
Watch Mode
For active development, use watch mode to automatically recompile on changes:Extension Watch
- Monitors file changes
- Automatically recompiles
- Runs
tsc-aliasto resolve path aliases - Updates source maps
Client Watch
Production Package Build
Pre-publish Build
npm run biome:check- Check code qualitynpm run test- Run all testsnpm run compile:clean- Clean output directorynpm run compile:esbuild- Build extension for desktopnpm run compile:esbuild:web- Build web extension
Package the Extension
- Prepares README for marketplace
- Creates
.vsixpackage file - Restores original README
jt-view-exports-svg-{version}.vsix
The
vscode:prepublish script is automatically run by vsce package before creating the extension package.Build Configurations
TypeScript Configurations
tsconfig.cjs.json- CommonJS compilationtsconfig.esm.json- ES Module compilationtsconfig.types.json- Type declarationsclient/tsconfig.json- Client TypeScript configclient/tsconfig.app.json- Client app configclient/tsconfig.node.json- Client Node config
Build Tool Configurations
esbuild.config.js- ESBuild configuration for extensionclient/vite.config.ts- Vite configuration for webviewbiome.json- Code formatting and linting
Development vs Production
| Aspect | Development | Production |
|---|---|---|
| Compilation | TypeScript (tsc) | ESBuild |
| Minification | No | Yes |
| Source Maps | Yes | No |
| Tree Shaking | No | Yes |
| Build Speed | Slower | Faster |
| Bundle Size | Larger | Optimized |
Troubleshooting
Build Errors
TypeScript errors:Clean Everything
If you encounter persistent issues:Next Steps
- Learn about testing the extension
- Set up your development environment
- Understand the project architecture