I am getting multiple errors when trying to access my application:
Refused to apply style from 'http://localhost:8000/styles.2466d75470f9c2227ee1.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'http://localhost:8000/runtime.205c879ce8dbb57b9cca.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'http://localhost:8000/polyfills.ce2bae2f7a5e6e1939c2.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'http://localhost:8000/main.510119795446e9da8a78.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Folder structure:
- main project folder
- - src
- - - config
- - - - express file
- - client
- - - build
- - - - index.html and other files after build
In express file I have this:
app.use(express.static('../../client/build/'));
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, '../../client', 'build', 'index.html'));
});
What am I doing wrong?
http://localhost:8000/styles.2466d75470f9c2227ee1.cssis hittingexpress.staticnot finding a matching file then moving on toapp.get('*'and getting an HTML document. There's no way to know why those files don't exist. - Quentinhttp://localhost:8080/) and that HTML document triggers requests for the subsequent URLs to load CSS and JS that it depends on. - Quentin