Skip to content

Instantly share code, notes, and snippets.

@andrewiggins
Last active December 3, 2025 21:18
Show Gist options
  • Select an option

  • Save andrewiggins/9295086feadac9e3d978d5bafd8ea8cc to your computer and use it in GitHub Desktop.

Select an option

Save andrewiggins/9295086feadac9e3d978d5bafd8ea8cc to your computer and use it in GitHub Desktop.
Preact + Vite + TS minimal hello world
dist
package-lock.json
pnpm-lock.yaml
node_modules
<script type="module" src="index.tsx"></script>
import { render } from "preact";
render(<h1>Hello World!</h1>, document.body);
{
"name": "preact-vite-hello-world",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tsc": "tsc -p tsconfig.json"
},
"devDependencies": {
"@preact/preset-vite": "^2.10.2",
"@types/node": "^24.10.1",
"typescript": "^5.9.3",
"vite": "^7.2.6"
}
}
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"jsxImportSource": "preact",
"strict": true,
"noEmit": true,
"types": []
}
}
import { defineConfig } from "vite";
import preact from "@preact/preset-vite";
export default defineConfig({
plugins: [preact()],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment