Accepted answer

In webpack 5 automatic node.js polyfills are removed. In the migration docs it is mention that

  • Try to use frontend-compatible modules whenever possible.
  • It's possible to manually add a polyfill for a node.js core module. An error message will give a hint on how to achieve that.
  • Package authors: Use the browser field in package.json to make a package frontend-compatible. Provide alternative implementations/dependencies for the browser.

See this issue.

Now you can refer this PR and check the libs that were removed and install them. Next add alias for the lib in your webpack config.

For ex.

resolve: {
    alias: {
       process: "process/browser"

Update: This can also be done using ProvidePlugin


"devDependencies": {
   "process": "0.11.10",


module.exports = {
  plugins: [
      new webpack.ProvidePlugin({
             process: 'process/browser',


I have this problem for HtmlWebpackPlugin, I added 'templateParameters' parameter to HtmlWebpackPlugin and it was fixed for me:

new HtmlWebpackPlugin({
      baseUrl: '/',
      template: 'app/index.html',
      templateParameters(compilation, assets, options) {
        return {
          webpack: compilation.getStats().toJson(),
          webpackConfig: compilation.options,
          htmlWebpackPlugin: {
            files: assets,
      chunksSortMode: 'auto',
      minify: {
        collapseWhitespace: false,
      cache: true,


Hope the correction I proposed will be accepted and released soon


npm i process was all I needed.

Related Query

More Query from same tag