Skip to content

Conversation

@chitoku-k
Copy link
Contributor

Description

This PR fixes an issue where webpack fails to handle modules prefixed with node: by the following error that is bundled in the production build by doing somewhat similar to #36506 for the build-html stage.

In this specific example importing node:path fails while importing path succeeds on [email protected]. When this type of import appears in any of dependencies such as vfile@^6.0 (vfile/vfile@bc0332c), gatsby users cannot fix their builds.

 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:path" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:path



  UnhandledSchemeError: Reading from "node:path" is not handled by plugins (Unhandled scheme).
  Webpack supports "data:" and "file:" URIs by default.
  You may need an additional plugin to handle "node:" URIs.

Documentation

Tests

Locally tested with a project that uses unified() (which introduces vfile@^6.0).

Related Issues

Possibly addresses #38357
Related to the merged PR #36506

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 3, 2023
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pieh pieh merged commit a08c8a0 into gatsbyjs:master Jan 3, 2024
@chitoku-k chitoku-k deleted the webpack/node-prefix branch January 3, 2024 15:37
@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 23, 2024
pieh pushed a commit that referenced this pull request Jan 23, 2024
pieh pushed a commit that referenced this pull request Jan 23, 2024
This was referenced May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Published

Development

Successfully merging this pull request may close these issues.

2 participants