Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: export 'default' (imported as 'streams') was not found in 'web-streams-polyfill' with Webpack 5.42.0 #15

Closed
RuslanAktaev opened this issue Jul 28, 2021 · 2 comments

Comments

@RuslanAktaev
Copy link

RuslanAktaev commented Jul 28, 2021

Hello @Gozala, thanks for your answer. I've recreated the issue, since web-file-polyfill project has been archived.

Original issue

Problem
I have Angular Universal project and I use this package to create File and Blob polyfills on server side. After updating to Angular v12 I faced some problem with building app.

My server.ts file:

import { createWindow } from 'domino';
import { File, Blob } from 'web-file-polyfill';

const win = createWindow(template);

global.window = win as Window & typeof globalThis;
global.document = win.document;

global.localStorage = localStorage;
global.File = File;
global.Blob = Blob;

When I try to build project, an error throws:

./node_modules/@web-std/blob/src/package.js:4:51-58 - Error: export 'default' (imported as 'streams') was not found in 'web-streams-polyfill' (possible exports: ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, TransformStreamDefaultController, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter)

If I change import in the @web-std/blob/src/package.js:

import * as streams from "web-streams-polyfill"

It works well.

Steps to reproduce:

  1. Clone this project
  2. Run npm i and npm run dev:ssr

File in which I use @web-std/file

@Gozala
Copy link
Contributor

Gozala commented Aug 25, 2021

I’m afraid suggested change would then break this library in nodejs because that is how node deals with ESM / commonjs interop. If docs for the package could be trusted following should work import from web-streams-polyfill/es6 might work.

@RuslanAktaev I don’t have time to work on this, but if you do have and will submit a pull that does not break tests I’ll merge it.

@Gozala
Copy link
Contributor

Gozala commented Jan 19, 2022

Closing this due to inactivity

@Gozala Gozala closed this as completed Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants