Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 3b1fd16

Browse files
committed
fix(rollup): fix bug with not generating source-map correctly
fix bug with not generating source-map correctly
1 parent 3e8db00 commit 3b1fd16

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/rollup.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,18 @@ export function rollupWorker(context: BuildContext, configFile: string): Promise
8989
}
9090

9191
const bundleOutput = bundle.generate({
92-
format: rollupConfig.format
92+
format: rollupConfig.format,
93+
sourceMap: rollupConfig.sourceMap
9394
});
9495

9596
// write the bundle
96-
const jsFileToWrite = join(context.buildDir, rollupConfig.dest);
9797
const promises: Promise<any>[] = [];
98-
promises.push(writeFileAsync(jsFileToWrite, bundleOutput.code));
98+
promises.push(writeFileAsync(rollupConfig.dest, bundleOutput.code));
99+
context.fileCache.set(rollupConfig.dest, { path: rollupConfig.dest, content: bundleOutput.code});
99100
if (bundleOutput.map) {
100-
promises.push(writeFileAsync(jsFileToWrite + '.map', bundleOutput.map));
101+
const sourceMapContent = bundleOutput.map.toString();
102+
promises.push(writeFileAsync(rollupConfig.dest + '.map', sourceMapContent));
103+
context.fileCache.set(rollupConfig.dest + '.map', { path: rollupConfig.dest + '.map', content: sourceMapContent});
101104
}
102105
return Promise.all(promises);
103106
})

0 commit comments

Comments
 (0)