isaacs / node-lru-cache

A fast cache that automatically deletes the least recently used items
http://isaacs.github.io/node-lru-cache/
ISC License
5.38k stars 353 forks source link

Missing or broken source maps? #282

Closed mattgodbolt closed 1 year ago

mattgodbolt commented 1 year ago

We use lru-cache in Compiler Explorer and on upgrading to v8 recently we now see errors about "failed to parse source map" in our builds.

Not knowing too much about how this stuff works behind the scenes, is it possible the new v8 build refers to source maps that aren't being packaged in the npm?

mattgodbolt commented 1 year ago

An example: https://github.com/compiler-explorer/compiler-explorer/actions/runs/4419743631/jobs/7748559508#step:4:65

isaacs commented 1 year ago

It looks from that screenshot like it's trying to load the source itself. The source maps are definitely in there: https://unpkg.com/browse/lru-cache@8/dist/mjs/index.js.map

I don't ship the source code itself, that would be extremely unusual, and in almost all cases (except apparently this one?) unnecessary, since the main purpose of a source map is just to map stack frames back to their origin. I'm not opposed to including the source in the package, it's already public after all, but it increases the package size considerably, and there are many many TypeScript packages on npm that only ship their distributed artifacts, so I imagine this is going to be an issue with other deps as well, no?

isaacs commented 1 year ago

Can you try with v8.0.3 and see if that fixed it? (Apparently GitHub didn't respect my "maybe" in the commit message and closed the issue 😅)

mattgodbolt commented 1 year ago

Hahah Github has more confidence than you :D That did indeed fix things! Thanks so much!