Closed yzhe819 closed 2 years ago
Excellent write up, this is super helpful ❤️
Hey @bourdakos1 can you reproduce this issue?
Yes, this is a known issue. Just haven’t had a chance to fix it yet. Feel free to open a PR if you want to take a crack at it
This issue has been resolved in the above pr #196.
For old versions, this can be easily fixed by setting the build command with the --no-minify
flag.
Just change the build command in your package.json
from the following:
"build": "docusaurus build",
By adding the --no-minify
flag at the end.
"build": "docusaurus build --no-minify",
Then, no crash issues.
The illegal value of token colour issue happened in the code editor section.
How to reproduce?
Started by trying to bootstrap a normal project.
And install url for url problem
Then fix the Package subpath './lib/sidebars/generator' issue by adding resolutions to package.json #160
And then yarn again
Then add the requestBody to the post method on the templete
Now, we can successfully run our project. Here is what we get. The "name" and "hello world" on the request body section are displayed correctly.
However, when I built this project and deployed it. This page will crash. (The same page, the post request of the pets)
Here is the error msg:
To test it locally, you can globally install http-server, which is a node.js package to allow us use my computer to test the build file. And just run it on the build folder. Here is my test step:
Reason:
After checking the code, I found the reason.
This error is thrown by the Monaco Editor. For the editor, it uses the regex to check whether this color is a valid color. The checking rule is the valid color must start with the #symbol. Then, follow the six-length color variable (like ffffff); finally, it allows the transparent variable.
When the project is built, the value of --openapi-Monaco-background-color (#ffffff) is transferred to the shorthand style (#fff). Therefore, the editor will throw this as not a valid token.
To prove that, we can search the --openapi-monaco-background-color for the build file. We can get the value of --openapi-monaco-background-color is #fff (on the build/assets/css/styles.[hash].css
We can just change this to #ffffff, and then run the HTTP-server again (or deploy this changed build file again)
Then, you can see no more crashes for the request body.