Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Expected a JavaScript module script #19

Closed
glad2os opened this issue Feb 16, 2024 · 1 comment
Closed

Expected a JavaScript module script #19

glad2os opened this issue Feb 16, 2024 · 1 comment

Comments

@glad2os
Copy link

glad2os commented Feb 16, 2024

Google chrome logs:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

default config:

server {
    listen 5173;

    location / {
    root /usr/share/nginx/html;
    index index.html index.htm;
    try_files $uri $uri/ /index.html =404;
    }

    include /etc/nginx/extra-conf.d/*.conf;

}

# Build stage
FROM node:20.11 AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# Serve stage
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY default.conf /etc/nginx/conf.d/default.conf
EXPOSE 5173
CMD ["nginx", "-g", "daemon off;"]

@tiangolo
Copy link
Owner

Hello there!

I no longer use nor recommend this Docker image, I think you are much better off building a Docker image yourself, so I updated all the docs to explain how to do it: https://github.com/tiangolo/node-frontend

The only extra step is creating and copying a simple nginx.conf file that you can copy-paste.

Given that, I'll now close this one. But thanks for the interest! ☕

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

No branches or pull requests

2 participants