Issue Dockerizing React Application with Vite

  Kiến thức lập trình

I created a react application and is running properly on my computer.
I then dockerized it to run it on the server. However, I am having problem in this :

(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.

Here is the docker file:
# Use the official Node.js image as a base image
FROM node:18-alpine

# Set the working directory inside the container
WORKDIR /app

# Add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

     # Install and cache app dependencies
    COPY package.json /app/package.json
    RUN npm install
    RUN npm install @vue/[email protected] -g

    # Start app
    CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
    here is the vite.config.js file :
    export default defineConfig({
    plugins: [vue(), vueJsx()],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    },
         build: {
            rollupOptions: {
              input: {
                main: resolve(__dirname, 'index.html'),
               }
           }
         }
         })

I created a react application and is running properly on my computer.
I then dockerized it to run it on the server. However, I am having problem in this :

(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.

LEAVE A COMMENT