Skip to content

Commit da12cf9

Browse files
authored
feat(commonjs): add requireReturnsDefault to types (#579)
1 parent a6ff567 commit da12cf9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/commonjs/types/index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ interface RollupCommonJSOptions {
5555
* like `"/Users/John/Desktop/foo-project/"` -> `"/"`.
5656
*/
5757
dynamicRequireTargets?: string | ReadonlyArray<string>;
58+
/**
59+
* Controls what is returned when requiring an ES module or external dependency
60+
* from a CommonJS file. By default, this plugin will render it as a namespace
61+
* import, i.e.
62+
*
63+
* ```js
64+
* // input
65+
* const foo = require('foo');
66+
*
67+
* // output
68+
* import * as foo from 'foo';
69+
* ```
70+
*
71+
* @default false
72+
*/
73+
requireReturnsDefault?: boolean | 'auto' | 'preferred' | ((id: string) => boolean | 'auto' | 'preferred');
5874
}
5975

6076
/**

0 commit comments

Comments
 (0)