Jacky Zhao
2023-08-09 ad3f7b2d5fe15af2626250463994f5a9e9ba6d0a
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
    }
  },
}