未定义自动前缀

时间:2018-12-13 11:50:58

标签: webpack sass

在config文件夹中的webpack.config.dev.js文件中,我尝试添加加载程序,以便我的.scss文件可以处理:

      {
        test: /\.css$/,
        use: [
          require.resolve('style-loader'),
          {
            loader: require.resolve('css-loader'),
            options: {
              importLoaders: 1,
            },
          },
          {
            loader: require.resolve('postcss-loader'),
            options: {
              // Necessary for external CSS imports to work
              ident: 'postcss',
              plugins: () => [
                require('postcss-flexbugs-fixes'),
                autoprefixer({
                  browsers: [
                    '>1%',
                    'last 4 versions',
                    'Firefox ESR',
                    'NOT IE < 9', // React doesn't support IE8 anyway
                  ],
                  flexbox: 'no-2009',
                }),
              ],
            },
          },
        ],
      },
      {
        test: /\.scss$/,
        loaders: [
          require.resolve('style-loader'),
          require.resolve('css-loader'),
          require.resolve('sass-loader')
        ]
      }, 

但是,出现以下错误...

无法编译。

./ src / index.scss(./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!.//node_modules/sass- loader / lib / loader.js!./ src / index.scss) ReferenceError:未定义autoprefixer

有人可以帮忙吗?

0 个答案:

没有答案