mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-16 02:14:56 +08:00
fix(rollup): globals in BundleOptions can be a method
d92f072627/src/finalisers/shared/setupNamespace.js (L6)
This commit is contained in:
2
types/rollup/index.d.ts
vendored
2
types/rollup/index.d.ts
vendored
@@ -31,7 +31,7 @@ export interface BundleOptions {
|
||||
/** The name to use for the module for UMD/IIFE bundles (required for bundles with exports). */
|
||||
name?: string
|
||||
/** Mapping of IDs → global variable names. Used for UMD/IIFE bundles. */
|
||||
globals?: { [id: string]: string }
|
||||
globals?: ((id: string) => string) | { [id: string]: string }
|
||||
/**
|
||||
* Function that takes an ID and returns a path, or Object of id: path pairs.
|
||||
* Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN.
|
||||
|
||||
@@ -87,6 +87,22 @@ async function main() {
|
||||
strict: true,
|
||||
})
|
||||
|
||||
await bundle.write({
|
||||
format: 'cjs',
|
||||
file: 'bundle.js',
|
||||
name: 'myLib',
|
||||
interop: false,
|
||||
globals: (x: string) => x.replace("", "/"),
|
||||
banner: '/* Banner */',
|
||||
footer: '/* Footer */',
|
||||
intro: 'var ENV = "production";',
|
||||
outro: 'var VERSION = "1.0.0";',
|
||||
indent: ' ',
|
||||
sourcemap: 'inline',
|
||||
sourcemapFile: 'bundle.js.map',
|
||||
strict: true,
|
||||
})
|
||||
|
||||
const watcher = watch({
|
||||
input: 'main.js',
|
||||
output: {
|
||||
|
||||
Reference in New Issue
Block a user