unjs/jiti

`JITI_SOURCE_MAPS` option is not included in cache params

Closed this issue · 2 comments

Environment

Node.js 22

Reproduction

  1. Run this file without any special settings. Notice there's no sourcemap for main.ts
  2. In the API turn on sourcemaps, or set JITI_SOURCE_MAPS
  3. Run it again. Notice there's still no sourcemap for main.ts 🐛
  4. Set JITI_FS_CACHE=0, and notice sourcemaps now work

Describe the bug

Changing the Jiti options should invalidate any existing cache

Additional context

Reported as an issue for the VS Code debugger in microsoft/vscode-js-debug#2149

Logs

No response

pi0 commented

We should add a -map suffix here to distinguish cache entries with map enabled.

pi0 commented

Thanks for report dear @connor4312. I have merged #352 as fix for cache issue. Can you try with jiti-nightly? 🙏🏼 (you can ensure cache is updated using JITI_DEBUG=1. if issue persists with +map files still, this is not directly an issue with jiti (but tooling that wrongly skips sourcemap hint)