The spec plate at Dodi’s workshop: set alias, base, outDir, define, the port and a plugin’s enforce, see the vite.config.js it writes and what Vite 8 does…
Nearly every modern frontend project uses Vite. One config line can break @/ imports, make a site in a subfolder lose every script, stop a build over one define value, or leave a plugin quietly doing nothing. Knowing each line means reading the error, not copying someone else’s config.
A Vite config is rules, and every rule has an order
.jsx/.tsx files; JSX in a .js file gives this error, with a hint to rename it. .vue files need @vitejs/plugin-vue. For React, @vitejs/plugin-react adds Fast Refresh and React's JSX setup.@ alias works in Vite but the editor marks it red TypeScript and the editor read tsconfig.json, not vite.config.js. Add "paths": { "@/*": ["./src/*"] } there too, and use an absolute path (path.resolve) in Vite.define or import.meta.env Both are pasted as text into the bundle every visitor downloads. Only keys starting with VITE_ reach import.meta.env, and all of them are public. Secrets stay on the server../src alias fail, then fix it A relative value is looked up from the importing file's folder. path.resolve(__dirname, 'src') points at the same place from anywhere.base for a site at /cabang/ The script's address in index.html changes with it, and the browser asks for it inside the branch folder.define, then fix it '1.2.0' without inner quotes is no expression. JSON.stringify('1.2.0') writes a valid string.enforce: 'pre' Only then does it see the JSX before vite:oxc turns it into JS.