Closed loynoir closed 2 years ago
The polyfill does not yet fully support native ESM in Node. I'm currently working on this for v4.0 in #83, which should land soon(ish).
For now, you can work around this by importing the .mjs
file directly (as suggested by the error message):
import { ReadableStream as PonyReadableStream } from 'web-streams-polyfill/dist/ponyfill.mjs'
This is implemented in #83. Give it a spin with the latest beta release: v4.0.0-beta.3. 😉
Note that the polyfill's exports have changed in 4.0, see MIGRATING for more information. Your example would now look like this:
// test.mjs
import { ReadableStream as PonyReadableStream } from 'web-streams-polyfill'
console.log(PonyReadableStream)
Reproduce
Expect
No error
Actual
Else