TailwindCSS 与 Webpack 项目

TailwindCSS with Webpack project

对不起,我正在尝试制作使用 TailwindCSS(PostCSS 插件)、Webpack v5、babel、eslint 和 stylelint 的 Electronjs 项目,但我 运行 这个错误(当 运行 webpack serve --color --progress --config webpack.dev.js).感谢你的帮助 我的错误图片在这里:Error

如果你也想要的话,这里有日志:

ERROR in ./src/main.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/prettier-loader/prettier-loader.js):
SyntaxError: Leading decorators must be attached to a class declaration. (1:9)
> 1 | @import 'tailwindcss/base';
    |         ^
  2 | @import 'tailwindcss/components';
  3 | @import 'tailwindcss/utilities';
  4 | @import './css/font.css';
    at Us (D:\genzoc\node_modules\prettier\parser-babel.js:22:7277)
    at tn (D:\genzoc\node_modules\prettier\parser-babel.js:22:66392)
    at Object.parse (D:\genzoc\node_modules\prettier\parser-babel.js:22:334269)
    at Object.parse$a [as parse] (D:\genzoc\node_modules\prettier\index.js:13652:19)
    at coreFormat (D:\genzoc\node_modules\prettier\index.js:15183:16)
    at formatWithCursor (D:\genzoc\node_modules\prettier\index.js:15423:14)
    at D:\genzoc\node_modules\prettier\index.js:60171:12
    at Object.format (D:\genzoc\node_modules\prettier\index.js:60191:12)
    at Object.module.exports (D:\genzoc\node_modules\prettier-loader\prettier-loader.js:98:31)
    at processResult (D:\genzoc\node_modules\webpack\lib\NormalModule.js:703:19)
    at D:\genzoc\node_modules\webpack\lib\NormalModule.js:809:5
    at D:\genzoc\node_modules\loader-runner\lib\LoaderRunner.js:399:11
    at D:\genzoc\node_modules\loader-runner\lib\LoaderRunner.js:251:18
    at context.callback (D:\genzoc\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
    at Object.module.exports (D:\genzoc\node_modules\prettier-loader\prettier-loader.js:100:12)
 @ ./src/main.js 1:0-20

我的回购是 here: https://github.com/Cokaps/GenZOC

好吧,你试过在其他 linters 之前加载 postcss 吗? (在你的配置中,prettier-loader 运行 在 postcss 之前。你可能想要禁用那些 linters(移动到另一个文件,因为 linting 在你的情况下没用,你正在尝试 lint 依赖项)