Skip to content

v4.9.0 onward invalid character error when using a dollar sign followed by a symbol (e.g. "$#") #466

Closed
@evan-sheehan

Description

@evan-sheehan

Describe the bug
Writing a dollar sign '$' in code followed immediately by certain symbols (in my case I've confirmed it with '#' and '@') throws an invalid character error.

Logs
image

To Reproduce
Try setting a variable to the string "$#" in a Typescript enabled Sveltekit page and attempt to build the project or run dev and navigate to the respective page.
Here is a repo example: https://github.com/evan-sheehan/svelte-preprocess-bug
I used the "npm init svelte@next" command according to Sveltekit documentation and started a project using the demo template with Typescript but no Eslint and no Prettier.

Expected behavior
An error should not be thrown when svelte-preprocess parses '$#' in the context of a string or comment.

Information about your project:

  • Chrome Version 96.0.4664.45 (Official Build) (64-bit)
  • Zorin 16 - Ubuntu 20.04. 3 LTS
  • Svelte-preprocess anything 4.9.0 and after as far as I've tested.
  • Using Sveltekit so Vite and Rollup are used internally.

Seems related to #402 but not exactly the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions