当我想在我的 App.jsx 中导入 Fontello 自动生成的 CSS 文件时,它给了我一个错误:
./src/assets/fontello/css/fontello.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/assets/fontello/css/fontello.css)
Syntax error: Unknown word (58:1)
56 | }
57 |
> 58 | .icon-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="14.766" viewBox="0 0 16 14.766"> <g id="Examples" transform="translate(-246.5 -7.77)"> <g id="albums-outline" transform="translate(198.5 -56.23)"> <g id="Group_59" data-name="Group 59" transform="translate(48 67.432)"> <path id="Path_67" data-name="Path 67" d="M62.27,171.334H49.727A1.747,1.747,0,0,1,48,169.567v-7.8A1.749,1.749,0,0,1,49.727,160H62.273A1.749,1.749,0,0,1,64,161.767v7.8A1.752,1.752,0,0,1,62.27,171.334ZM49.727,161.259a.5.5,0,0,0-.5.508v7.8a.5.5,0,0,0,.5.508H62.273a.5.5,0,0,0,.5-.508v-7.8a.5.5,0,0,0-.5-.508Z" transform="translate(-48 -160)" fill="#30c0b0"/> </g> <g id="Group_60" data-name="Group 60" transform="translate(49.716 64)"> <path id="Path_68" data-name="Path 68" d="M113.269,80h8.883M112,81.716h11.42" transform="translate(-111.428 -79.428)" fill="#30c0b0"/> <path id="Path_69" data-name="Path 69" d="M107.936,66.86H96.628a.575.575,0,1,1,0-1.144h11.308a.575.575,0,1,1,0,1.144Zm-1.256-1.716h-8.8a.575.575,0,1,1,0-1.144h8.8a.575.575,0,1,1,0,1.144Z" transform="translate(-96 -64)" fill="#30c0b0"/> </g> </g> </g> </svg>albums-outline:before { content: '\e801'; } /* '' */
| ^
59 | .icon-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="14.766" viewBox="0 0 16 14.766"> <g id="Examples" transform="translate(-246.5 -7.77)"> <g id="albums-outline" transform="translate(198.5 -56.23)"> <g id="Group_59" data-name="Group 59" transform="translate(48 67.432)"> <path id="Path_67" data-name="Path 67" d="M62.27,171.334H49.727A1.747,1.747,0,0,1,48,169.567v-7.8A1.749,1.749,0,0,1,49.727,160H62.273A1.749,1.749,0,0,1,64,161.767v7.8A1.752,1.752,0,0,1,62.27,171.334ZM49.727,161.259a.5.5,0,0,0-.5.508v7.8a.5.5,0,0,0,.5.508H62.273a.5.5,0,0,0,.5-.508v-7.8a.5.5,0,0,0-.5-.508Z" transform="translate(-48 -160)" fill="#30c0b0"/> </g> <g id="Group_60" data-name="Group 60" transform="translate(49.716 64)"> <path id="Path_68" data-name="Path 68" d="M113.269,80h8.883M112,81.716h11.42" transform="translate(-111.428 -79.428)" fill="#30c0b0"/> <path id="Path_69" data-name="Path 69" d="M107.936,66.86H96.628a.575.575,0,1,1,0-1.144h11.308a.575.575,0,1,1,0,1.144Zm-1.256-1.716h-8.8a.575.575,0,1,1,0-1.144h8.8a.575.575,0,1,1,0,1.144Z" transform="translate(-96 -64)" fill="#30c0b0"/> </g> </g> </g> </svg>chatbubble-outline:before { content: '\e802'; } /* '' */
60 | .icon-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="14.766" viewBox="0 0 16 14.766"> <g id="Examples" transform="translate(-246.5 -7.77)"> <g id="albums-outline" transform="translate(198.5 -56.23)"> <g id="Group_59" data-name="Group 59" transform="translate(48 67.432)"> <path id="Path_67" data-name="Path 67" d="M62.27,171.334H49.727A1.747,1.747,0,0,1,48,169.567v-7.8A1.749,1.749,0,0,1,49.727,160H62.273A1.749,1.749,0,0,1,64,161.767v7.8A1.752,1.752,0,0,1,62.27,171.334ZM49.727,161.259a.5.5,0,0,0-.5.508v7.8a.5.5,0,0,0,.5.508H62.273a.5.5,0,0,0,.5-.508v-7.8a.5.5,0,0,0-.5-.508Z" transform="translate(-48 -160)" fill="#30c0b0"/> </g> <g id="Group_60" data-name="Group 60" transform="translate(49.716 64)"> <path id="Path_68" data-name="Path 68" d="M113.269,80h8.883M112,81.716h11.42" transform="translate(-111.428 -79.428)" fill="#30c0b0"/> <path id="Path_69" data-name="Path 69" d="M107.936,66.86H96.628a.575.575,0,1,1,0-1.144h11.308a.575.575,0,1,1,0,1.144Zm-1.256-1.716h-8.8a.575.575,0,1,1,0-1.144h8.8a.575.575,0,1,1,0,1.144Z" transform="translate(-96 -64)" fill="#30c0b0"/> </g> </g> </g> </svg>checkmark-done-outline:before { content: '\e803'; } /* '' */
您可以从这里下载完整的 CSS 文件(点击页面右侧的红色按钮)。
我没有针对 Webpack 的特殊配置。而且我不确定它是否与 Webpack 有关。我还尝试删除 node_modules 并重新安装软件包,但没有成功。