Fix HMR issue with customElements

This commit is contained in:
Sebastian Martinez
2023-11-15 15:46:15 +01:00
committed by Rūdolfs Ošiņš
parent 838ee1b420
commit 94985d0489
3 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
set -e
npx tsc --noEmit
npx svelte-check --tsconfig tsconfig.json --fail-on-warnings
npx svelte-check --tsconfig tsconfig.json --fail-on-warnings --compiler-warnings missing-custom-element-compile-options:ignore
npx eslint --cache --cache-location node_modules/.cache/eslint --max-warnings 0 .
npx prettier "**/*.@(ts|js|svelte|json|css|html|yml)" --ignore-path .gitignore --check --cache
-3
View File
@@ -2,7 +2,4 @@ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
export default {
preprocess: vitePreprocess(),
compilerOptions: {
customElement: true,
},
};
+10
View File
@@ -14,6 +14,16 @@ export default defineConfig({
},
plugins: [
svelte({
// Reference: https://github.com/sveltejs/vite-plugin-svelte/issues/270#issuecomment-1033190138
experimental: {
dynamicCompileOptions({ filename }) {
if (path.basename(filename) === "Clipboard.svelte") {
return {
customElement: true,
};
}
},
},
compilerOptions: { dev: process.env.NODE_ENV !== "production" },
}),
configureDevServer(),