This website collects cookies to deliver better user experience
docker-compose.yaml
version: "3" services: yarn: image: node:16.0.0 user: node working_dir: /home/node tty: true stdin_open: true entrypoint: yarn command: --help volumes: - .:/home/node
vite.config.js
export default { esbuild: { jsxFactory: "h", jsxFragment: "Fragment" } };
index.jsx
import {h, render} from "preact"; import {useCallback} from "preact/hooks"; const App = () => { const onButtonClick = useCallback(() => alert("Hello, Preact"), []); return ( <button onClick={onButtonClick}> Hello </button> ); }; const app = document.getElementById("app"); if (app) { render(<App />, app); }
index.html
<!DOCTYPE html> <html> <body> <div id="app"></div> <script src="./index.jsx" type="module"></script> </body> </html>
$ docker-compose run yarn add preact vite $ docker-compose run --publish 3000:3000 yarn vite --host $ open http://localhost:3000
$ docker-compose run yarn vite build
27
0