FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
175 stars 55 forks source link

Missing `__esModule` marker #23

Open dmaretskyi opened 3 years ago

dmaretskyi commented 3 years ago

I'm trying to build an app with snowpack, that uses packages that were compiled with typescript with esModuleInterop on.

It seems like the interop functions injected by typescript think that poyfills are commonjs modules.

So for example if I have:

import assert from 'assert'

assert(true)
```javascript

this gets compiled by typescript to 

```javascript
const assert_1 = __importDefault(require("assert"));

assert_1.default(true)

and in the runtime assert_1 is

{
  default: {
     default: assertFn,
  }
}

the top-level default get inserted by __importDefault