错误:resolve-url-loader:处理 CSS 时出错

问题描述 投票:0回答:3

我正在使用 scss 和 [电子邮件受保护] 在进行生产构建期间,我收到此错误。

Error: resolve-url-loader: error processing CSS
  Invalid mapping: {"generated":{"line":1,"column":176},"source":"file://D:\\SSC-BUZZ JAN-2022\\ssc-buzz-client\\src\\styles\\index.scss","original":{"column":null},"name":null}
reactjs
3个回答
3
投票

这让我彻底疯了。对我有用的是添加

"resolutions": {
    "resolve-url-loader": "5.0.0"
  }

package.json
强制每个包使用版本 5。我现在可以成功构建。


0
投票

删除@import行中的引号(“”)


0
投票

唯一对我有用的解决方案是将单个 @apply 样式转换为基本 CSS。例如,更改此:

.code
    @apply mt-5;

.code
    margin-top: 15px;

如果您在元素中使用单个 @apply 样式,只需将其转换为常规 CSS 即可。对于多个 @apply 样式,它们应该按预期工作。

© www.soinside.com 2019 - 2024. All rights reserved.