Vite is a convenient development server and build tool for web-component projects. Its local HTTP server lets a page load ECMAScript modules instead of opening the page as a local file, which can trigger browser security errors. Vite also supports TypeScript. When you save a source file, hot module replacement updates the page without a full refresh, preserving page state. section 3.5
Run a web-component demo
A page can import a button component with a module script and render it as <wa-button>Click Me</wa-button>. Install Vite with npm install -D vite, add a dev script, then run npm run dev and open the local address Vite reports. The same setup can serve a vanilla sortable-table component or a Lit project. section 2.2 section 4.3 section 5.1
"build": "vite build", #1 "dev": "vite", #2 "preview": "vite preview", #3
These package.json scripts provide commands to start the server, build the app, and preview the build. section 3.5
For a production build, Vite bundles application code and dependencies, removes unused code through tree shaking, and can split code into chunks loaded on demand. It is a practical choice, not a web-component requirement: another HTTP server can serve the page, and FAST and wrec projects do not require Vite. section 3.5 section 7.2

