Home > Enterprise >  Refused to apply style from css MIME Type
Refused to apply style from css MIME Type

Time:10-04

I used vite to create a react app with typescript and I follow a tutorial to get a good starter (Console.log

From here, I'm totally lost. Any help would be appreciated. My dockerfile

FROM nginx

## Remove default Nginx website
RUN rm -rf /usr/share/nginx/html/*

## Copy our default nginx config
COPY nginx/default.conf /etc/nginx/nginx.conf

COPY /dist/* /usr/share/nginx/html/

RUN  cd /usr/share/nginx
RUN  ln -s /usr/share/nginx/html /usr/share/nginx/www
RUN  ln -s /usr/share/nginx/html /etc/nginx/html
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

CodePudding user response:

Finally, i solved it. It was a silly mistake. In my dockerfile, I copied all the files from dist, but no the directory structure.

Before:

dist
│   index.12321.js
│   index.12321.css
│   index.html
│   vite.svg.     

Now:

dist  
└───assests
│   │   index.12321.js
│   │   index.12321.css
│   index.html
│   vite.svg.   

The solution was change this command

COPY /dist/* /usr/share/nginx/html/

to this COPY /dist/ /usr/share/nginx/html/

Removing the * solved the pain.

  • Related