I have a node.js backend project, and I use webpack to build it.
"webpack": "^4.46.0",
"webpack-cli": "^4.4.0"
it reports error like
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: this.getOptions is not a function
Then I read the source code of /node_modules/babel-loader/lib/index.js to figure out why.

As you can see in the screenshot, there's only one search result of this.getOptions() in the node_modules/babel-loader/lib/index.js file. No definition of the function and it just be used. It's supposed to be a bug, at least it looks like that.
Why does the babel team write souce code like that? And why do all others think it's a version conflict but not a code bug itself?
See getOptions method for Loaders
babel-loader9.x supports webpack 5.x, since it usesthis.getOptionsIf you want to use webpack 4.x, then you should use
babel-loader8.x which supports webpack 4.x or 5.x.babel-loder8.x usesloaderUtils.getOptions(this)The version compatibility instructions are very clear on the readme