Skip to content

[Bug]: Panic occurred at runtime - quasic should be not empty #12706

@findoo

Description

@findoo

System Info

System:
OS: macOS 26.2
CPU: (11) arm64 Apple M3 Pro
Memory: 1.19 GB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.21.1 - /Users/finlaysmith/.nvm/versions/node/v22.21.1/bin/node
npm: 10.9.4 - /Users/finlaysmith/.nvm/versions/node/v22.21.1/bin/npm
pnpm: 10.12.1 - /Users/finlaysmith/homebrew/bin/pnpm
bun: 1.3.1 - /Users/finlaysmith/.bun/bin/bun
Watchman: 2025.04.28.00 - /Users/finlaysmith/homebrew/bin/watchman
Browsers:
Chrome: 143.0.7499.193
Chrome Canary: 145.0.7630.0
Firefox Developer Edition: 147.0
Safari: 26.2

Details

Issue Title

Panic: "quasic should be not empty" when using Unicode escape sequences in template literals

Bug Description

Rspack panics with quasic should be not empty when processing code containing Unicode escape sequences inside template literals.

Steps to Reproduce

See the minimal reproducible example at: https://github.com/findoo/rspack-repro

The absolute minimal reproduction is just one line:

const regex = new RegExp(`\uD83C[\uDFFB-\uDFFF]`, 'g');

No interpolation or complex expressions needed - just a Unicode escape sequence in a template literal.

Expected Behavior

The code should compile successfully, as it does with:

  • Webpack 5.104.1 ✅
  • Node.js native execution ✅

Actual Behavior

Build fails with panic:

panicked at crates/rspack_plugin_javascript/src/utils/eval/eval_tpl_expr.rs:35:10:
quasic should be not empty

Environment

  • Rspack: 1.7.1
  • Node: v22.21.1
  • OS: macOS

Workaround

Use regular string literals instead of template literals:

const regex = new RegExp('\\uD83C[\\uDFFB-\\uDFFF]', 'g');

Note: double backslashes required for string literals.

Additional Context

  • Encountered in production emoji processing code
  • The issue occurs even without any template literal interpolations
  • Related to template literal evaluator handling of Unicode escapes

Minimal Repro Repository

https://github.com/findoo/rspack-repro

Reproduce link

https://github.com/findoo/rspack-repro

Reproduce Steps

  • Check out reproduction repo
  • run npm run build:webpack -> passes
  • run npm run build:rspack -> errors

Metadata

Metadata

Labels

pending triageThe issue/PR is currently untouched.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions