makondratev
2024-02-18 8c5c5f9130c65fcc48412a24b0a6c98b254f1934
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import fs from "fs"
import sourceMapSupport from "source-map-support"
import { fileURLToPath } from "url"
 
export const options: sourceMapSupport.Options = {
  // source map hack to get around query param
  // import cache busting
  retrieveSourceMap(source) {
    if (source.includes(".quartz-cache")) {
      let realSource = fileURLToPath(source.split("?", 2)[0] + ".map")
      return {
        map: fs.readFileSync(realSource, "utf8"),
      }
    } else {
      return null
    }
  },
}