Tailwind with Sass:在plugins[0]处找到无效的PostCSS插件



我正试图在PostCSS上使用TailwindCSS,并将Sass作为预处理器。每当我试图开始我的项目时,我都会收到这个错误:

[07:18:19] Error: ModuleBuildError: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: Invalid PostCSS Plugin found at: plugins[0]

我有这些配置:

webpack.config.js

{
test: /.(sa|sc)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: "css-loader",
options: {
importLoaders: 2,
},
},
{
loader: "postcss-loader",
},
{
loader: "sass-loader",
},
],
},

postss.config.js

module.exports = {
plugins: [
require("postcss-import"),
require("tailwindcss"),
require("autoprefixer"),
],
};

我遇到过类似的问题,但这些问题一直无法解决。最后,我切换到旧版本来暂时解决它们,这取决于以下

"@tailwindcss/postcss7-compat": "^2.2.17",
"autoprefixer": "^9.8.8",
"postcss": "^7.0.39",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",

相关内容

  • 没有找到相关文章

最新更新