qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[🐞] Qwik City app breaks in dev mode with legacy decorators

Open octet-stream opened this issue 1 year ago • 13 comments

Which component is affected?

Qwik Rollup / Vite plugin

Describe the bug

I've been playing around with Qwik and Qwik City building simple demos. Pretty great framework so far, by the way! But when I decided to try it with Mikro ORM I stumbled upon following issue: Qwik breaks with TypeScript legacy decorators and Mikro ORM relies heavily on decorators for database schema definition, so I need those to work properly to be able to use Mikro ORM with Qwik app. The issue appears only in in dev mode.

Reproduction

https://github.com/octet-stream/qwik-legacy-decorators-issue

Steps to reproduce

  1. Clone this repo
  2. Install dependencies via pnpm i
  3. Run pnpm start and you'll see following error
[vite] Pre-transform error: Expression expected
[vite] Pre-transform error: Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key
[vite] Pre-transform error: Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key (x2)

This error does not appear in preview mode. Run pnpm preview to verify it. Vite will open your browser and you'll see a todo list app. You will be able to add and remove todos.

System Info

System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 95.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.3.0 - ~/Library/Caches/fnm_multishells/9803_1704038600457/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.2.4 - ~/Library/Caches/fnm_multishells/9803_1704038600457/bin/npm
    pnpm: 8.13.1 - /opt/homebrew/bin/pnpm
    bun: 1.0.21 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 120.0.6099.216
    Safari: 17.2.1
  npmPackages:
    @builder.io/qwik: ^1.3.5 => 1.3.5
    @builder.io/qwik-city: ^1.3.5 => 1.3.5
    undici: * => 6.3.0
    vite: ^5.0.11 => 5.0.11

Additional Information

I saw similar issue, but the error is still there and happens only in dev mode, so I believe there's a way to make it work for dev mode as well without bringing some additional plugins. Also, from what I can tell reading the comments the solution with babel plugin doesn't work.

octet-stream avatar Jan 12 '24 19:01 octet-stream