0

Get the following error after running npm run build in laravel. If I run npm run dev everything seems to work fine. But in build this error occurs.

rendering chunks (2)...warnings when minifying css:
▲ [WARNING] Expected identifier but found "*" [css-syntax-error]

    <stdin>:1:30219:
      1 │ ...fter{clear:both}.swagger-ui .cf{*zoom:1}.swagger-ui .cl{clear:le...
        ╵          

Following error is shown during loading the swagger page:

Uncaught TypeError: Cannot read properties of undefined (reading 'isRequired') swagger.67892d56.js:162 
 at 1543 (swagger.67892d56.js:162:9585)
    at Ve (swagger.67892d56.js:191:4143)
    at swagger.67892d56.js:193:40222
    at swagger.67892d56.js:193:72778

I am building a laravel application and using swagger for route documentation. In production it works well but during build this error occurs.

2 Answers2

0

Looks like this issue which was fixed in Swagger UI v. 4.15.3. Update your app to use the latest version of Swagger UI.

Helen
  • 87,344
  • 17
  • 243
  • 314
  • Thank you. Rendering warning did go away with update but swagger still shows Uncaught TypeError: Cannot read properties of undefined (reading 'isRequired') error during rendering the page – Guram Tsagareishvili Nov 25 '22 at 10:13
  • Errors like that usually happen when there are syntax errors in the OpenAPI definition. [Export your OpenAPI YAML/JSON file](https://stackoverflow.com/a/48525934/113116) from Swagger UI, paste its content into https://editor.swagger.io, and see if the editor flags any errors. – Helen Nov 25 '22 at 12:45
0

I have the same issue on v4.18.2. The solution just embed Swagger UI's code directly in your HTML by using unpkg's interface. See this issue.

Jim
  • 259
  • 3
  • 7