This is very confusing as seen in #12974 or #12906. My suggestion would be "legacy."
"pdfjs-lib": path.join(__dirname, "web/pdfjs"),
      },
    },
    devtool: enableSourceMaps ? "source-map" : undefined,
    module: {
      rules: [
        {
          loader: "babel-loader",
          exclude: babelExcludeRegExp,
          options: {
            presets: skipBabel ? undefined : ["@babel/preset-env"],
            plugins: babelPlugins,
          },
        },
        {
          loader: path.join(__dirname, "external/webpack/pdfjsdev-loader.js"),
          options: {
            rootPath: __dirname,
            saveComments: false,
            defines: bundleDefines,
          },
        },
      ],
    },
    
    
    node: false,
  };
}
function webpack2Stream(webpackConfig) {