Skip to content

Using vite 4.4.0 or 4.4.1 breaks Typescript decorator support in some projects #13736

@hybridherbst

Description

@hybridherbst

Describe the bug

I'm a bit at a loss at what's going on - in a project I have using vite 4.4.0 or 4.4.1 breaks decorators in TypeScript, but going back to 4.3.9 fixes the issue.

All I'm getting on 4.4.0 is SyntaxError: Invalid character: '@' (on some code on our end that uses decorators), while in 4.3.9 everything works.

What is extra weird is that I can't reproduce the issue on StackBlitz even with the same setup / configs in place. I've included my tests so far nonetheless, as I can 100% reproduce the issue locally by switching between vite 4.4.0 and 4.3.9 as dependency.

Discord discussion: https://discord.com/channels/804011606160703521/804011606160703524/1126556878676168784

Reproduction

Tried to repro here but no luck so far: https://stackblitz.com/edit/vitejs-vite-ojnmgf?file=myPackage%2FmyCode.ts

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.4.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 221.48 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.1 - /usr/local/bin/node
    npm: 9.5.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 114.0.5735.198
    Safari: 16.5.1
  npmPackages:
    @vitejs/plugin-basic-ssl: ^1.0.1 => 1.0.1 
    vite: 4.4.1 => 4.4.1

Used Package Manager

npm

Logs

Click to expand!
SyntaxError: Invalid character: '@'

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)regressionThe issue only appears after a new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions