diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 946b4f6786..b1a67c9fdc 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -135,7 +135,7 @@ export interface Plugin { * Returning null or undefined defers to other resolveId functions (and eventually the default resolution behavior); * returning any other falsy value signals that importee should be treated as an external module and not included in the bundle. */ - resolveId?(importee: string, importer: string): string | null | undefined | false | 0 | '' + resolveId?(importee: string, importer: string | undefined): string | null | undefined | false | 0 | '' /** A module transformer function */ transform?(this: TransformContext, source: string, id: string): string | { code: string, map: SourceMap } /** A bundle transformer function */ diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index 924e675373..078cdf5450 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -5,6 +5,12 @@ declare const console: { log(...messages: any[]): void, warn(message: string): v let cache: Bundle | undefined const plugin: Plugin = { name: 'test-plugin', + resolveId(importee, importer) { + if (importer === undefined) { + return 'custom/entry/point.js' + } + return importer.trim() + }, transform(source, id) { if (id === 'rxjs') { this.error(new Error(`Don't import this directly`))