diff options
Diffstat (limited to 'runtime.ts')
-rw-r--r-- | runtime.ts | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/runtime.ts b/runtime.ts index 9ca3b4944..57b556c21 100644 --- a/runtime.ts +++ b/runtime.ts @@ -19,16 +19,24 @@ const EOL = "\n"; type AmdFactory = (...args: any[]) => undefined | object; type AmdDefine = (deps: string[], factory: AmdFactory) => void; -sourceMaps.install({ - installPrepareStackTrace: true, - getGeneratedContents: (filename: string): string => { - util.log("getGeneratedContents", filename); - if (filename === "dist/main.js") { - return null; +export function setup(mainJs: string, mainMap: string): void { + sourceMaps.install({ + installPrepareStackTrace: true, + getGeneratedContents: (filename: string): string => { + if (filename === "/main.js") { + return mainJs; + } else if (filename === "/main.map") { + return mainMap; + } else { + const mod = FileModule.load(filename); + if (!mod) { + console.error("getGeneratedContents cannot find", filename); + } + return mod.outputCode; + } } - return FileModule.load(filename).outputCode; - } -}); + }); +} // This class represents a module. We call it FileModule to make it explicit // that each module represents a single file. |