When webpack uses loader, an error is reported (resolved) TypeError: this.getResolve is not a function

1. Problem description

  • webpack version: 3.6.0
  • css-loader:5.0.1
  • style-loader:2.0.0

Error when packing:
Insert picture description here


2. The cause of the error

The version of webpack is low, and the version of css-loader and style-loader is high. The version does not match.


3. Solution

You can manually reduce the version of css-loader and style-loader in the package.json file.

"devDependencies": {
    
    
    "css-loader": "^3.3.0",
    "style-loader": "^1.0.0",
    "webpack": "^3.6.0"
}

After the modification is completed, enter in the terminal npm installto reinstall the project dependencies of css-loader and style-loader. Then repack it.

In addition, if we encounter similar error messages in the process of using loader, the high probability is a version problem. The version of a loader may be too high.

such as:

  • UnhandledPromiseRejectionWarning: TypeError: this.getResolve is not a function
  • Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The “from” argument must be of type string. Received undefined

Guess you like

Origin blog.csdn.net/weixin_43974265/article/details/112667927