我在使用 Symfony 設置 TailwindCSS 時遇到問題,我不確定出了什么問題webpack.config.jsvar Encore = require('@symfony/webpack-encore');if (!Encore.isRuntimeEnvironmentConfigured()) { Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');}Encore .setOutputPath('public/build/') .setPublicPath('/build') .addStyleEntry('tailwind', './assets/css/tailwind.css') .enablePostCssLoader((options) => { options.config = { // directory where the postcss.config.js file is stored path: './postcss.config.js' }; })這是輸出yarn encore devyarn run v1.22.0 運行 webpack ...錯誤 編譯失敗,有 1 個錯誤./assets/css/tailwind.css 中的錯誤ValidationError:選項對象無效。PostCSS Loader 已使用與 API 架構不匹配的選項對象進行初始化。options 有一個未知的屬性“config”。這些屬性是有效的:object { postcssOptions?,execute?,sourceMap? }入口點 tailwind = runtime.jsModuleBuildError:模塊構建失?。▉碜?./node_modules/postcss-loader/dist/cjs.js):ValidationError:選項對象無效。PostCSS Loader 已使用與 API 架構不匹配的選項對象進行初始化。options 有一個未知的屬性“config”。這些屬性是有效的:object { postcssOptions?,execute?,sourceMap? } 在 validate (./node_modules/schema-utils/dist/validate.js:104:11) 在 Object.loader (./node_modules/postcss-loader/dist/index.js:43:29)" -t "Webpack Encore" 錯誤 命令失敗,退出代碼 2。信息 請訪問 https://yarnpkg.com/en/docs/cli/run以獲取有關此命令的文檔我有節點 v14.15.0,我嘗試進行紗線升級。這是我的直接依賴項:成功保存鎖定文件。成功保存了 598 個新的依賴項。info 直接依賴 ├─ @symfony/ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]├─ [email protected]└─ [email protected]就像我之前所說的,我不確定出了什么問題,并且我嘗試自己糾正問題失敗了。該錯誤似乎來自 postcss 或至少來自我的文件中 postcss 不喜歡的內容。有人可以解釋一下這個錯誤從何而來以及如何糾正嗎?
將 TailwindCSS 與 Symfony Webpack Encore 結合使用
天涯盡頭無女友
2023-11-12 22:19:30