@@ -12,7 +12,12 @@ import { makeNodeResolvePlugin, makeSucrasePlugin } from './plugins/index.js';
12
12
const packageDotJSON = require ( path . resolve ( process . cwd ( ) , './package.json' ) ) ;
13
13
14
14
export function makeBaseNPMConfig ( options = { } ) {
15
- const { entrypoints = [ 'src/index.ts' ] , externals : packageSpecificExternals = [ ] , hasBundles = false } = options ;
15
+ const {
16
+ entrypoints = [ 'src/index.ts' ] ,
17
+ esModuleInterop = false ,
18
+ externals : packageSpecificExternals = [ ] ,
19
+ hasBundles = false ,
20
+ } = options ;
16
21
17
22
const nodeResolvePlugin = makeNodeResolvePlugin ( ) ;
18
23
const sucrasePlugin = makeSucrasePlugin ( ) ;
@@ -43,6 +48,17 @@ export function makeBaseNPMConfig(options = {}) {
43
48
// get: () => are.great,
44
49
// });
45
50
externalLiveBindings : false ,
51
+
52
+ // Equivalent to `esModuleInterop` in tsconfig.
53
+ // Controls whether rollup emits helpers to handle special cases where turning
54
+ // `import * as dogs from 'dogs'`
55
+ // into
56
+ // `const dogs = require('dogs')`
57
+ // doesn't work.
58
+ //
59
+ // `auto` -> emit helpers
60
+ // `esModule` -> don't emit helpers
61
+ interop : esModuleInterop ? 'auto' : 'esModule' ,
46
62
} ,
47
63
48
64
plugins : [ nodeResolvePlugin , sucrasePlugin ] ,
0 commit comments