Skip to content

Error with loading bundle.css in development mode, MIME type error #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
muhammad-usman-anwar opened this issue Mar 2, 2020 · 4 comments

Comments

@muhammad-usman-anwar
Copy link

Hi I was facing this issue on a project, first I thought I have messed up my webpack configuration. I tried few thing with my css plugins but nothing changed so I went about and created a fresh project using the template. Still giving the same issue.
The build one works fine generates a proper css file but having error in the development mode.
NPM has automatically installed the following versions.
webpack: v4.42.0
svelte: v3.19.1

image

@gavinr
Copy link

gavinr commented Mar 10, 2020

I am having this issue too.

Refused to apply style from 'http://localhost:8080/bundle.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

@tedwash
Copy link

tedwash commented Mar 19, 2020

Looks like the README is missing a step. Since bundle.css doesn't exist yet, you have to run npm run build before npm run dev in order to output the file to the public folder.

Looks like this can be solved by updating the webpack config to serve bundle.css: #12 (comment)

@muhammad-usman-anwar
Copy link
Author

@tedwash that is not a solution, doing this will yield a static load of css file (the result of build command) every time. Then what is the point of even running npm run dev, if you can't see the changes to the css made at runtime. And you have to rebuild app every time you make changes to the css.

@muhammad-usman-anwar
Copy link
Author

muhammad-usman-anwar commented Mar 21, 2020

#24 The pull request will resolve the issue.

Do the same change, replace prod ? MiniCssExtractPlugin.loader : 'style-loader' with MiniCssExtractPlugin.loader. The issue was with style loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants