I'm trying to dockerize a frontend app which was created using vite and vue3. It is not working as a container. Here is the error response.
(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.
VITE v3.2.4 ready in 191 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.17.0.2:5173/
(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.
Dockerfile
# base image
FROM node:16.3.0-alpine
# set working directory
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"]
vite.config.ts
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
}
}
}
})
index.html exist in the same directory with vite.config.ts and .Dockerfile. Thanks in advance.
You are probably using the command yarn dev run instead of yarn run dev to run the dev server
This error usually occurs when your css or js files are missing from the specified folder. Like for example in your viteconfig.js file. it always look like this
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
],
refresh: true,
}),
],
Confirm if those files are in the right place or if you've moved them to a folder like public then you need to update here to
plugins: [
laravel({
input: [
'public/css/app.css',
'public/js/app.js',
],
refresh: true,
}),
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With