由于CSS迷你化插件的“未知单词”错误,React构建失败。当我运行npm run build,时,它会持续失败!
编译失败。
静态/ Css /main.d3e3749c.css来自Css迷你插件static\css\main.d3e3749c.css:698:13:未知单词:1,0
我的Node版本是16.14.0。在npm start,中,一切都很好,但是构建失败了。也许这要归功于PostCSS。我试着降低版本的等级,但没有起作用。
package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.8.1",
"@emotion/styled": "^11.8.1",
"@mui/icons-material": "^5.4.4",
"@mui/material": "^5.4.4",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.26.0",
"emoji-mart": "^3.0.1",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet-async": "^1.2.3",
"react-infinite-scroll-component": "^6.1.0",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"react-scroll-to-bottom": "^4.2.0",
"react-slick": "^0.28.1",
"react-toastify": "^8.2.0",
"redux": "^4.1.2",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.4.1",
"slick-carousel": "^1.8.1",
"socket.io-client": "^4.4.1",
"web-vitals": "^2.1.3",
"webfontloader": "^1.6.28"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"autoprefixer": "^10.4.2",
"postcss": "^8.4.8",
"tailwindcss": "^3.0.23"
}
}发布于 2022-03-19 09:01:16
我也有同样的问题,在我的例子中,错误是由顺风JIT模式引起的。我的风格是:
top-[${positionFromTop}]
在我的一个文件中,这导致了错误。
要找出错误的原因,您应该使用顺风CLI运行npx tailwindcss -i ./src/{YOUR_MAIN_CSS_FILE}.css -o ./dist/output.css --watch命令,然后检查output.css是否有任何语法错误。然后,只需修复导致语法错误的样式。
发布于 2022-03-23 07:14:57
我在尾风课上传递来自州的数据。
top-[${positionFromTop}]
解决方案:不要使用任何花哨的CSS。
https://stackoverflow.com/questions/71484883
复制相似问题