qwik
qwik copied to clipboard
[🐞] Qwik City app breaks in dev mode with legacy decorators
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
- Clone this repo
- Install dependencies via
pnpm i - Run
pnpm startand 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.