Created
March 25, 2022 07:03
-
-
Save raymond-w-ko/fea13a99975af5796e782699209d3b64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FS = require("fs") | |
const assert = require("assert") | |
const origSourceMap = JSON.parse(FS.readFileSync("./orig/index.js.map")) | |
const sections = origSourceMap.sections | |
assert.equal(sections.length, 1) | |
const sm = sections[0].map | |
const lineStart = sections[0].offset.line | |
const prefix = ";".repeat(lineStart) | |
sm.mappings = prefix + sm.mappings | |
FS.writeFileSync("index.js.map", JSON.stringify(sm)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment