Skip to content

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. #20819

@wdunn001

Description

@wdunn001

Bug Report

Affected Package

Angular/Core 12.0.0

Is this a regression?

Yes, the previous version in which this bug was not present was: 11.x.x

Description

You now receive an error while building an angular application regarding node polyfills and Webpack 5
https://i.stack.imgur.com/SpjFk.png

this is because of the following breaking change in Webpack 5
https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-nodejs-polyfills-removed

This breaking change didn't exist in previous versions of angular. We use node class libraries shared across the front and backend.

Minimal Reproduction

https://github.com/wdunn001/polyfill-example

Exception or Error


BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
        - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "assert": false }

Your Environment

Angular Version:


12.0.0

While this is a known breaking change and is easy to fix with Webpack 5 separately as far as I know it requires third party NPM libraries to fix in Angular which might not be an option for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions