Skip to content

[Bug]: rspack cannot bundle import.meta.resolve for nodejs #13046

@sadan4

Description

@sadan4

System Info

I was able to reproduce this bug with https://playground.rspack.rs

System Info
System:
  OS: Linux 6.18 cpe:/o:nixos:nixos:26.05 26.05 (Yarara)
  CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
  Memory: 50.84 GB / 62.63 GB
  Container: Yes
  Shell: 5.9 - /run/current-system/sw/bin/zsh
Binaries:
  Node: 25.6.0 - /etc/profiles/per-user/meyer/bin/node
  npm: 11.8.0 - /etc/profiles/per-user/meyer/bin/npm
  pnpm: 10.28.2 - /etc/profiles/per-user/meyer/bin/pnpm
  bun: 1.3.8 - /etc/profiles/per-user/meyer/bin/bun
  Deno: 2.6.6 - /etc/profiles/per-user/meyer/bin/deno
Browsers:
  Brave Browser: 144.1.86.148
  Chromium: 144.0.7559.132
  Firefox: 147.0.3
  Firefox Developer Edition: 147.0.3
npmPackages:
  @rspack/core: ^1.7.5 => 1.7.5 

Details

From what i can tell, support was added for this with #12317, which first released with 1.6.7, however this feature does not work, both locally (rspack 1.7.5) and via the online playground (rspack 1.7.3).

Reproduce link

https://playground.rspack.rs/#eyJyc3BhY2tWZXJzaW9uIjoiMi4wLjAtY2FuYXJ5LjIwMjYwMTIwIiwiaW5wdXRGaWxlcyI6W3siZmlsZW5hbWUiOiJyc3BhY2suY29uZmlnLmpzIiwidGV4dCI6ImV4cG9ydCBkZWZhdWx0IHtcbiAgbW9kZTogJ25vbmUnLFxuXHRlbnRyeTogXCIuL2luZGV4LmpzXCIsXG4gIG91dHB1dDoge1xuICAgIG1vZHVsZTogdHJ1ZSxcbiAgICBsaWJyYXJ5OiB7XG4gICAgICB0eXBlOiBcIm1vZHVsZVwiXG4gICAgfVxuICB9LFxuICB0YXJnZXQ6IFwibm9kZVwiLFxufTsifSx7ImZpbGVuYW1lIjoiaW5kZXguanMiLCJ0ZXh0IjoiZXhwb3J0IGNvbnN0IGZvbyA9IGltcG9ydC5tZXRhLnJlc29sdmUoc29tZXRoaW5nKTtcbmV4cG9ydCBjb25zdCBiYXIgPSBpbXBvcnQubWV0YS5kaXJuYW1lIn1dfQ==

Reproduce Steps

  1. use import.meta.resolve(/*...*/)
  2. notice rspack compiles it to ({}).resolve(/*...*/)

Metadata

Metadata

Assignees

No one assigned

    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