From f65ddd9a1e81cf9f7922911aa8242baa24846669 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Fri, 18 Sep 2020 15:39:38 +0800 Subject: [PATCH] feat(commonjs): add requireReturnsDefault to types --- packages/commonjs/types/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/commonjs/types/index.d.ts b/packages/commonjs/types/index.d.ts index 579e8914d..6157114dd 100644 --- a/packages/commonjs/types/index.d.ts +++ b/packages/commonjs/types/index.d.ts @@ -55,6 +55,22 @@ interface RollupCommonJSOptions { * like `"/Users/John/Desktop/foo-project/"` -> `"/"`. */ dynamicRequireTargets?: string | ReadonlyArray; + /** + * Controls what is returned when requiring an ES module or external dependency + * from a CommonJS file. By default, this plugin will render it as a namespace + * import, i.e. + * + * ```js + * // input + * const foo = require('foo'); + * + * // output + * import * as foo from 'foo'; + * ``` + * + * @default false + */ + requireReturnsDefault?: boolean | 'auto' | 'preferred' | ((id: string) => boolean | 'auto' | 'preferred'); } /**