8

After ng build or ng serve I got this error:

./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;

I use Angular:

   "@angular/animations": "^14.0.0",
    "@angular/common": "^14.0.0",
    "@angular/compiler": "^14.0.0",
    "@angular/core": "^14.0.0"
2
  • 1
    In case this helps anyone, I had this error but the answer was not the fix. It turns out that the scss file was not imported correctly in the Angular component using styleUrls styleUrls: ['./myCSSfile.scss'] It was instead added as an import in the component file. import 'myCSSfile.scss' Commented Nov 4, 2022 at 14:05
  • @Simon245 nice find. This was exactly my issue. didn't notice, because my IDE collapsed all imports :P Commented Mar 15, 2024 at 11:48

1 Answer 1

8

Add ol.css path inside angular.json styles array.

angular.json

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

For More Info

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.