A lightweight starter template for building optimized web components with Svelte 5 and TypeScript. Produces production-ready components with:
ā”ļø Ultra-lightweight output
š TypeScript-first development
š Universal component format (ES + UMD)
š§ Built-in Vite optimizations
šÆ CSS isolation per component
š¦ Zero-dependency components
npm install
npm run dev
npm run build
npm run preview
<script type="module" src="/dist/my-web-components.es.js"></script>
<my-component name="Developer"></my-component>
import { MyComponent } from './dist/my-web-components.es.js';
// Components auto-register on import
src/wc/
```svelte
<svelte:options customElement="my-element" />Add to src/wc/web-components.ts
export { default as MyElement } from './MyElement.wc.svelte';
Rebuild with npm run build
Command | Description |
---|---|
npm run dev |
Start dev server with HMR |
npm run build |
Build production-ready components |
npm run preview |
Locally preview production build |
npm run check |
Validate TypeScript types |
Core Technologies
Optimization Features
āāā src/
ā āāā wc/ # Web components
ā ā āāā MyComponent.wc.svelte
ā ā āāā web-components.ts # Component registry
ā āāā lib/ # Svelte components
ā āāā App.svelte # Demo application
ā āāā main.ts # Entry point
āāā vite.config.ts # Build configuration
āāā svelte.config.js # Svelte compiler settings
MIT Ā© Dariusz Sikorski
Made with ā„ by Dariusz Sikorski