Thanks to visit codestin.com
Credit goes to github.com

Skip to content

resolve.fallback and resolve.alias do not work with node: prefix #14166

@alexander-akait

Description

@alexander-akait

Bug report

resolve.fallback and resolve.alias do not work with node: prefix

What is the current behavior?

Module build failed: UnhandledSchemeError: Reading from "node:fs" 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.

If the current behavior is a bug, please provide the steps to reproduce.

webpack.config.js

module.exports = {
    mode: "development",
    target: "web",
    entry: "./entry.js",
    resolve: {
      fallback: {
        path: false,
        'node:path': false,
      },
      alias: { 
        path: false,
        'node:path': false,
      }
    }
};

entry.js

import * as mod from "node:fs";

console.log(mod);

What is the expected behavior?

fallback and aliases should work

Other relevant information:
webpack version: 5.52.0
Node.js version: any
Operating System: any
Additional tools: any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To be discussed

    Status

    Priority - Low

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions