From f48239914debf85c8145db703671e1a438fa3d13 Mon Sep 17 00:00:00 2001 From: Oliver Ford Date: Tue, 3 Aug 2021 22:10:56 +0000 Subject: [PATCH] [fix] warning on reactive use of module const (#6606) (#6607) --- src/compiler/compile/Component.ts | 2 +- .../samples/reactive-module-const-variable/input.svelte | 9 +++++++++ .../samples/reactive-module-const-variable/warnings.json | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/validator/samples/reactive-module-const-variable/input.svelte create mode 100644 test/validator/samples/reactive-module-const-variable/warnings.json diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index fabe9e0316..5c83d1f346 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -1312,7 +1312,7 @@ export default class Component { if (variable) { variable.is_reactive_dependency = true; - if (variable.module) { + if (variable.module && variable.writable) { should_add_as_dependency = false; module_dependencies.add(name); } diff --git a/test/validator/samples/reactive-module-const-variable/input.svelte b/test/validator/samples/reactive-module-const-variable/input.svelte new file mode 100644 index 0000000000..c89cc1c1d0 --- /dev/null +++ b/test/validator/samples/reactive-module-const-variable/input.svelte @@ -0,0 +1,9 @@ + + + diff --git a/test/validator/samples/reactive-module-const-variable/warnings.json b/test/validator/samples/reactive-module-const-variable/warnings.json new file mode 100644 index 0000000000..0d4f101c7a --- /dev/null +++ b/test/validator/samples/reactive-module-const-variable/warnings.json @@ -0,0 +1,2 @@ +[ +]