You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error
Importing the newest version of node-fetch (v2.4.0) is causing an error when building a project with webpack (4.30.0). This might be breaking many production environments. This is similar to #502.
ERROR in ./node_modules/node-fetch/lib/index.mjs 66:23-31
Can't import the named export 'Readable' from non EcmaScript module (only default export is available)
Cause
I believe the problem is because webpack doesn't resolve .mjs the same way node does. Importing node-fetch and running node v12.0.0 with experimental modules enabled runs without error. However, importing node-fetch using node v8.16.0 with experimental modules does result in the same error:
SyntaxError: The requested module does not provide an export named 'Readable'
Fix
I believe this can be fixed simply by changing the import in blob.js:
import { Readable } from 'stream';
to
import Stream from 'stream'
const Readable = Stream.Readable;
On Apr 27, 2019, at 14:03, mcuppi ***@***.***> wrote:
Error
Importing the newest version of node-fetch (v2.4.0) is causing an error when building a project with webpack (4.30.0). This might be breaking many production environments. This is similar to #502.
ERROR in ./node_modules/node-fetch/lib/index.mjs 66:23-31
Can't import the named export 'Readable' from non EcmaScript module (only default export is available)
Cause
I believe the problem is because webpack doesn't resolve .mjs the same way node does. Importing node-fetch and running node v12.0.0 with experimental modules enabled runs without error. However, importing node-fetch using node v8.16.0 with experimental modules does result in the same error:
SyntaxError: The requested module does not provide an export named 'Readable'
Fix
I believe this can be fixed simply by changing the import in blob.js:
import { Readable } from 'stream';
to
import Stream from 'stream'
const Readable = Stream.Readable;
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Error
Importing the newest version of node-fetch (v2.4.0) is causing an error when building a project with webpack (4.30.0). This might be breaking many production environments. This is similar to #502.
Cause
I believe the problem is because webpack doesn't resolve .mjs the same way node does. Importing node-fetch and running node v12.0.0 with experimental modules enabled runs without error. However, importing node-fetch using node v8.16.0 with experimental modules does result in the same error:
Fix
I believe this can be fixed simply by changing the import in blob.js:
to
I've submitted a pull request for this fix: #618
The text was updated successfully, but these errors were encountered: