Skip to content

{some const} is declared in a module script and will not be reactive #6606

@OJFord

Description

@OJFord

Describe the bug

#5847 added a warning when module variables are used reactively in non-module script.

This warning is triggered even if the variable is const. (And used reactively together with non-const variables, presumably!)

Reproduction

<script context="module">
export const doFoos = (a, b, c) => [a, b, c];
export const foo = 123;
</script>

<script>
export let bar;

$: foobar = doFoos(foo, bar, null);
</script>

Logs

(!) Plugin svelte: "doFoos" is declared in a module script and will not be reactive
(!) Plugin svelte: "foo" is declared in a module script and will not be reactive

System Info

System:
    OS: Linux 5.13 Arch Linux
    CPU: (4) x64 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz
    Memory: 4.66 GB / 15.56 GB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.6.0 - /usr/bin/node
    Yarn: 1.22.11 - /usr/bin/yarn
    npm: 7.20.3 - /usr/bin/npm
  Browsers:
    Firefox: 90.0.2

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions