CSS模块解析失败:意外令牌Angular 14?



在ng构建或ng服务后,我得到了这个错误:

./node_modules/ol/ol.css:1:0 - Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> .ol-box {
|   box-sizing: border-box;

我使用Angular:

"@angular/animations": "^14.0.0",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/core": "^14.0.0"

angular.json样式数组中添加ol.css路径

angular.json

"styles": ["node_modules/ol/ol.css"]

查看更多信息