diff --git a/scripts/check b/scripts/check index 14fedd92c..c0b827438 100755 --- a/scripts/check +++ b/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 diff --git a/svelte.config.js b/svelte.config.js index e02a04fca..d0e64483b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -2,7 +2,4 @@ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; export default { preprocess: vitePreprocess(), - compilerOptions: { - customElement: true, - }, }; diff --git a/vite.config.ts b/vite.config.ts index 218c13c4e..47fe5c4e2 100644 --- a/vite.config.ts +++ b/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(),