Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix HMR issue with customElements
Sebastian Martinez committed 2 years ago
commit 94985d0489a77356d6e731a50e8b3d6668cf46f2
parent 838ee1b4204b4f49222323fc458379c69a8876af
3 files changed +11 -4
modified scripts/check
@@ -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
modified svelte.config.js
@@ -2,7 +2,4 @@ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";

export default {
  preprocess: vitePreprocess(),
-
  compilerOptions: {
-
    customElement: true,
-
  },
};
modified vite.config.ts
@@ -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(),