Skip to content

Comments in the code can cause the build to deadlock. #9362

@artxe

Description

@artxe

Describe the bug

an empty javascript comment block /**/ can cause the svelte compiler to lock up.

Reproduction URL

edit to add simplified reproductions:

original:
https://stackblitz.com/edit/sveltejs-kit-template-default-nq1apm?description=The%20default%20SvelteKit%20template,%20generated%20with%20create-svelte&file=src%2Froutes%2FCounter.svelte&title=SvelteKit%20Default%20Template

Reproduction

  1. If you run npm run build -- -d, the build will complete successfully.
  2. If you remove the block comment on line 180 of Counter.svelte and run the same command again, the build will deadlock after ssr compile.
  3. The cause is that if you change the last block comment on line 179. add an additional block comment or input something in comment, the build will complete successfully again.

The file contains three instances of code that is identical to the code on line 179.
There are no problems with any of the other lines.
The issue was not reproduced in a Vite fork.
It's odd that a bug could be caused by comments, but it's possible that there's a conflict between Svelte Kit and a Vite plugin.

Logs

✓ 152 modules transformed.
  vite:vite-plugin-svelte:stats ssr compile done.
  vite:vite-plugin-svelte:stats package         files     time     avg
  vite:vite-plugin-svelte:stats css-lube-docs      51    0.53s  10.3ms
  vite:vite-plugin-svelte:stats lube-ui            10   70.6ms   7.1ms +0ms

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 1.60 GB / 7.73 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.9.2 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22621.2134.0), Chromium (118.0.2088.61)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-static: ^2.0.3 => 2.0.3
    @sveltejs/kit: ^1.26.0 => 1.26.0
    svelte: ^4.2.2 => 4.2.2
    vite: ^4.5.0 => 4.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions