@druid-ui/vite
Vite plugin for DruidUI development with hot module replacement.
Installation
npm install --save-dev @druid-ui/vite
Usage
// vite.config.ts
import { defineConfig } from 'vite';
import druidUI from '@druid-ui/vite';
export default defineConfig({
plugins: [druidUI()]
});
Options
interface DruidUIPluginOptions {
sandbox?: boolean; // Enable WASM sandbox (default: false in dev)
witDir?: string; // Custom WIT directory
entry?: string; // Custom entry point
debug?: boolean; // Verbose logging
}
Example:
export default defineConfig({
plugins: [
druidUI({
sandbox: false, // Disable WASM in dev
debug: true
})
]
});
Development Modes
Raw Mode (Fast)
druidUI({ sandbox: false })
- Instant hot reload
- Normal debugging
- Not sandboxed (dev only)
Sandbox Mode
druidUI({ sandbox: true })
- Production-like
- True sandboxing
- Slower reload
HTML Template
Auto-served:
<!DOCTYPE html>
<html>
<body>
<druid-ui src="/src/index.tsx"></druid-ui>
<script type="module" src="/@druid-ui/client"></script>
</body>
</html>