小编Not*_*ard的帖子

带有 postcss 的 mini-css-extract 插件抛出 this.getOptions 不是一个函数

我正在尝试为我的个人项目设置一个顺风 css。这是一个反应 SSR 应用程序。我在 webpack 配置下的 postcss 设置有问题。它会在每个 *.css 文件(甚至是空文件)上抛出相同的错误。

好像无法解析配置文件或默认选项?尝试了不同的配置,但没有效果。最初,我认为这可能与我的 css 文件有关,但是如果我删除 postcss 插件,它们都有效并且可以编译

网络包配置

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');

const paths = require('./paths');

module.exports = {
  entry: {
    index: path.resolve(paths.projectSrc, 'index.js'),
  },
  resolve: {
    alias: {
      '@src': paths.projectSrc,
    },
  },
module: {
  rules: [
  {
    test: /.js$/,
    exclude: /node_modules/,
    use: {
      loader: 'babel-loader',
    },
  },
  {
    test: /\.html$/,
    use: [
      {
        loader: 'html-loader', …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack postcss tailwind-css mini-css-extract-plugin

6
推荐指数
1
解决办法
3097
查看次数