zoukankan      html  css  js  c++  java
  • webpack4(4.41.2) 打包出现 TypeError this.getResolve is not a function

    报错问题:

    webpack 打包出现 TypeError: this.getResolve is not a function

    环境:

    • nodejs 12.13.0
    • npm 6.12.0
    • webpack 4.41.2

    webpack 配置如下

    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
              }
            }
            ]
          }
        ]
      }
    }
    
    

    原因:

    出现该问题的情况是 sass-loader 版本过高, 用 ^8.0.0 版本出现该问题

    解决:

    先卸载当前 sass-loader 版本,后安装 "^7.3.1" 的 sass-loader 版本后正常使用。

    DEMO 实例

    参考:

  • 相关阅读:
    python023
    python019
    python018
    python017
    python016
    python013
    python012
    数据库,盘它!!!!
    网络编程
    面向对象简述
  • 原文地址:https://www.cnblogs.com/zhourongcode/p/11863802.html
Copyright © 2011-2022 走看看