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

fix(gatsby): support builtin modules prefixed with node: on build-html #38516

Merged
merged 11 commits into from
Jan 3, 2024

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 gatsby@5.12.3. 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
31 of 33 checks passed
@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 pieh added this to To cherry-pick in V5 Release hotfixes via automation Jan 23, 2024
pieh pushed a commit that referenced this pull request Jan 23, 2024
@pieh pieh moved this from To cherry-pick to Backport PR opened in V5 Release hotfixes Jan 23, 2024
pieh pushed a commit that referenced this pull request Jan 23, 2024
…html` (#38516) (#38818)

(cherry picked from commit a08c8a0)

Co-authored-by: Chitoku <chitoku-k@users.noreply.github.com>
@pieh pieh moved this from Backport PR opened to Backported in V5 Release hotfixes Jan 23, 2024
@pieh pieh moved this from Backported to Published in V5 Release hotfixes 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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants