I am trying to setup a simple project with Parcel and I'm running into what seems to be a silly issue.
After running parcel build ./Public/index.html (with index.html having a CSS link pointing to ./css/style.css), the CSS link in my outputted HTML file is preceded with /, as in /style.HASH.css which causes Chrome to kick the following error:
Refused to apply style from 'http://127.0.0.1:8080/style.c6b066be.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
This problem is easily fixed by manually changing the path to begin with either ./ or no slash at all.
Is this issue reproducible by anyone else? My package is up to date (I just installed it today), and I am not trying to use any additional plugins at this time.
You simply add --public-url ./ to the command.
This is not a bug and has been reported many times, please let us know how we can improve the docs to prevent this kind of issues.
Thanks a lot for the clarification!
I don't fully understand the reasoning behind why this is the default behavior since nesting CSS in a subfolder is very common, which is why I thought this might be a bug, but I'm sure there is a good reason for this behavior. Perhaps explaining in the docs more about why this is the default would be helpful for other noobs like me.
Thanks again!
Most helpful comment
Thanks a lot for the clarification!
I don't fully understand the reasoning behind why this is the default behavior since nesting CSS in a subfolder is very common, which is why I thought this might be a bug, but I'm sure there is a good reason for this behavior. Perhaps explaining in the docs more about why this is the default would be helpful for other noobs like me.
Thanks again!