mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Generate returns a promise
https://github.com/rollup/rollup/blob/master/src/rollup/index.js#L157-L188 "map" will be null if GenerateOptions.sourceMap is false
This commit is contained in:
Vendored
+1
-1
@@ -84,7 +84,7 @@ export interface WriteOptions extends BundleOptions {
|
||||
|
||||
export interface Bundle {
|
||||
/** Generate bundled code as an object */
|
||||
generate(options: GenerateOptions): { code: string, map: SourceMap }
|
||||
generate(options: GenerateOptions): Promise<{ code: string, map: SourceMap | null }>
|
||||
/** writes the file (and accompanying sourcemap file, if appropriate) to the file system. */
|
||||
write(options: WriteOptions): Promise<void>
|
||||
}
|
||||
|
||||
@@ -29,12 +29,14 @@ async function main() {
|
||||
plugins: plugin
|
||||
})
|
||||
|
||||
const result = bundle.generate({
|
||||
const { code, map } = await bundle.generate({
|
||||
format: 'cjs',
|
||||
indent: false,
|
||||
sourcemap: true,
|
||||
})
|
||||
|
||||
console.log(code, map)
|
||||
|
||||
cache = bundle
|
||||
|
||||
await bundle.write({
|
||||
|
||||
Reference in New Issue
Block a user