reactjs CssSyntaxError -Tailwind和Next.js项目中的未知单词

sqougxex  于 2023-02-12  发布在  React
关注(0)|答案(1)|浏览(187)

10小时后,仍然无法部署我的应用程序,由于以下构建失败。使用React/Next与Tailwind。
我相信它来自PostCSS插件,但我找不到我的任何错误(如果它是一个),它运行在本地主机完美之前,生产构建。任何方法来确定哪个类是错误的?
部署时出现以下错误。

HookWebpackError: /vercel/path0/static/css/50ca08b8d4bb65eb.css:1043:73: Unknown word
    at makeWebpackError (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:41664:9)
    at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:25354:12
    at eval (eval at create (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:140346:10), <anonymous>:34:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
-- inner error --
CssSyntaxError: /vercel/path0/static/css/50ca08b8d4bb65eb.css:1043:73: Unknown word
    at Input.error (/vercel/path0/node_modules/next/node_modules/postcss/lib/input.js:148:16)
    at ScssParser.unknownWord (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:522:22)
    at ScssParser.other (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:149:12)
    at ScssParser.parse (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:59:16)
    at scssParse (/vercel/path0/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:322)
    at new LazyResult (/vercel/path0/node_modules/next/node_modules/postcss/lib/lazy-result.js:133:16)
    at Processor.process (/vercel/path0/node_modules/next/node_modules/postcss/lib/processor.js:28:14)
    at CssMinimizerPlugin.optimizeAsset (/vercel/path0/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:43:12)
    at /vercel/path0/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at runMicrotasks (<anonymous>)
caused by plugins in Compilation.hooks.processAssets
CssSyntaxError: /vercel/path0/static/css/50ca08b8d4bb65eb.css:1043:73: Unknown word
    at Input.error (/vercel/path0/node_modules/next/node_modules/postcss/lib/input.js:148:16)
    at ScssParser.unknownWord (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:522:22)
    at ScssParser.other (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:149:12)
    at ScssParser.parse (/vercel/path0/node_modules/next/node_modules/postcss/lib/parser.js:59:16)
    at scssParse (/vercel/path0/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:322)
    at new LazyResult (/vercel/path0/node_modules/next/node_modules/postcss/lib/lazy-result.js:133:16)
    at Processor.process (/vercel/path0/node_modules/next/node_modules/postcss/lib/processor.js:28:14)
    at CssMinimizerPlugin.optimizeAsset (/vercel/path0/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:43:12)
    at /vercel/path0/node_modules/next/dist/build/webpack/plugins/css-minimizer-plugin.js:77:55
    at runMicrotasks (<anonymous>)
> Build failed because of webpack errors
Error: Command "npm run build" exited with 1

我看过其他线程,如Unknown word error from CSS Minimizer plugin on React build,并尝试遵循指导方针,但我找不到任何Tailwind类,这可能是不正确的或先进的,至少不能手动.有什么方法可以做到这一点的帮助下,从扩展或类似?

rjee0c15

rjee0c151#

查看此主题:Why am I getting this error (Tailwind + Next.js)? HookwebpackError, CssSyntaxError
在我的例子中,问题出在我的tailwind.config.js上。
首先,我将查找任何动态类名,在代码库中搜索[${或类似名称以找到它们。
在删除这些代码后仍然失败,我从git恢复了tailwind.config.js的以前版本,我知道它以前可以工作,并且能够成功地构建。
具体而言,构建失败的原因是包括:

extend: {
      backgroundImage: {
        "primary-underline": "linear-gradient(180deg,transparent 80%,hsla(205,100%,55%,0.5) 0);"
      },
}

EOL时的;是罪魁祸首。

相关问题