webpack4 (4.41.2) package appears TypeError this.getResolve is not a function

Error problem:

webpack package appears TypeError: this.getResolve is not a function

surroundings:

  • nodejs 12.13.0
  • 6.12.0 asl
  • webpack 4.41.2

webpack configured as follows

var webpack = require('webpack')
var path = require('path')

module.exports = {
  entry: [
    './app.js'
  ],
  output: {
    path: path.resolve(__dirname, './build'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          {loader: 'style-loader'},
          {loader: 'css-loader'}
        ]
      },

      {
        test: /\.scss$/,
        use: [
          {loader: 'style-loader'},
          {loader: 'css-loader'},
          {loader: 'sass-loader'}
        ]
      },
      {
        test: /\.(png|jpg)$/,
        use: [
          {loader: 'url-loader',
          options: {
            limit: 8192
          }
        }
        ]
      }
    ]
  }
}

the reason:

The problem happens is that sass-loader version is too high, with the emergence of the problem version 8.0.0 ^

solve:

Uninstall the current sass-loader version, after installation "^ 7.3.1" the sass-loader later version of normal use.

DEMO examples

reference:

Guess you like

Origin www.cnblogs.com/zhourongcode/p/11863802.html