🐛 📺 fixes dev server

This commit is contained in:
2026-05-20 14:40:00 +02:00
parent 139b1590ce
commit 7d6240e28a
3 changed files with 59 additions and 34 deletions
+16 -10
View File
@@ -1,21 +1,27 @@
// import { hmrPlugin, presets } from "@open-wc/dev-server-hmr";
/** Use Hot Module replacement by adding --hmr to the start command */
const hmr = process.argv.includes("--hmr");
/** Use Hot Module replacement by adding --watch to the start command */
//const hmr = process.argv.includes("--watch");
const [ mode ] = process.argv.slice(2);
const target = mode === "src" // OR "dist"
? {
rootDir: ".",
appIndex: "./index.html",
}
: {
rootDir: "./dist",
appIndex: "./dist/index.html",
};
export default /** @type {import("@web/dev-server").DevServerConfig} */ ({
open: "/",
watch: !hmr,
/** Resolve bare module imports */
nodeResolve: {
open: "/", // SPA routing
nodeResolve: { // Resolve bare module imports
exportConditions: ["browser", "development"],
},
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
// esbuildTarget: "auto"
// esbuildTarget: "auto" // Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
/** Set appIndex to enable SPA routing */
appIndex: "./index.html",
...target,
plugins: [
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */