Educational demo: Fast development server with plugin-based transformations
- TypeScript/JSX - Sub-50ms compilation via esbuild
- WebAssembly - Native Go-to-WASM pipeline
- Plugins - Extensible transformation system
- Zero Config - Works out of the box
git clone https://github.com/user/vite-go.git
cd vite-go && go run .
Visit http://localhost:9090
Type | Output | Time |
---|---|---|
.ts/.tsx |
ES modules | ~15ms |
.js/.jsx |
ES modules | ~10ms |
.go |
WASM + JS | ~80ms |
.css |
Injected styles | ~3ms |
type Plugin interface {
Name() string
Match(fileInfo *FileInfo) bool
Transform(ctx context.Context, fileInfo *FileInfo) (*TransformResult, error)
Priority() int
}
Example:
type SassPlugin struct{}
func (p *SassPlugin) Name() string { return "Sass" }
func (p *SassPlugin) Match(fi *FileInfo) bool { return fi.Extension == ".scss" }
func (p *SassPlugin) Priority() int { return 85 }
func (p *SassPlugin) Transform(ctx context.Context, fi *FileInfo) (*TransformResult, error) {
css, err := compileSass(fi.Content)
return &TransformResult{Code: css, ContentType: "text/css"}, err
}
// Register: pluginManager.Register(&SassPlugin{})
MIT