You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
constcache: {[fileUrl: string]: Promise<SourceMap>}={};// fetch file every requestfunctionfetchFile(fileUrl: string): Promise<SourceMap>;// fetch file only oncefunctionsourceMapProvider(fileUrl: string): Promise<SourceMap>{if(!(fileUrlincache)){// this will return promise that will fetched only oncecache[fileUrl]=fetchFile(fileUrl);}returncache[fileUrl];}
The text was updated successfully, but these errors were encountered:
@moshest This project is really in a early stage and I still don't have a complete vision regarding production usage of it. This is why I left a convenient way to provide your own sourceMapProvider. If your only need so far is a caching mechanism you can easily achieve that by memorizing one of the built-in source map providers. Take a look at the example below:
importmemoizefrom"lodash/memoize"// although you can use any memoize function you likeimport{StackRetracer,httpProvider}from"stack-retrace"constsourceMapProvider=memoize(httpProvider)conststackRetracer=newStackRetracer({ sourceMapProvider })
In the next version, I will definitely export types like RawSourceMaps so integrating your custom code will be easier and will not require any hacks as you presented here #4 (comment).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It should use a caching mechanism like this:
The text was updated successfully, but these errors were encountered: