Skip to content

Fix rvalue error when using arrow functions in {@const} #7206

Closed
@Maritims

Description

@Maritims

Describe the bug

When creating a markup variable with {@const}, whose value uses an arrow function in some way (for example, finding an item in an array), Svelte will fail with the error:
Assigning to rvalue (Note that you need plugins to import files that are not JavaScript)

This does not happen in version 3.46.2, but does happen in version 3.46.3. Can be verified by modifying the version string in the reproduction url.

There was recently an arrow function related error reported in #7134 - it seems related.

Reproduction

https://svelte.dev/repl/2932dbf792f54f9ab5c7f8365e640905?version=3.46.3

Logs

Assigning to rvalue (Note that you need plugins to import files that are not JavaScript)
     at error (/usr/src/app/node_modules/rollup/dist/shared/rollup.js:160:30)
     at Module.error (/usr/src/app/node_modules/rollup/dist/shared/rollup.js:12427:16)
     at Module.tryParse (/usr/src/app/node_modules/rollup/dist/shared/rollup.js:12815:25)
     at Module.setSource (/usr/src/app/node_modules/rollup/dist/shared/rollup.js:12718:24)
     at ModuleLoader.addModuleSource (/usr/src/app/node_modules/rollup/dist/shared/rollup.js:22215:20)

System Info

Docker image: node-latest - https://github.com/nodejs/docker-node/blob/5cafbd5b0462317bd024bb281af49585013473cd/17/bullseye/Dockerfile
Svelte 3.46.3
Browser: 97.0.4692.71

Severity

blocking an upgrade

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