Doesn't work with docker container #172
Comments
I had the same issue, the page keeps refreshing because vite tries to connect to websocket on port |
I also had the same issue but only exposing the
Taken from vitejs/vite#3002 |
Had the same issue with Docker and a nuxt3 blank project. So if you are faceing |
I noticed with a fresh install exposing However, after installing tailwind css the error resumed. Then creating a
Thanks @BobbieGoede and @gilesbutler |
We had this working through docker using @gilesbutler 's config until we updated to Nuxt 3 RC 1: nutxt.config.ts:
docker-compose.dev.yml:
Is anyone else having issues after upgrading to Nuxt 3 RC1? |
I have the same HMR issue with vite when running nuxt3 on Docker. It's reloading the page indefinitely. The port 24678 is open and the config seems right. This issue arise on both RC1 and RC2. nuxt.config.ts import { defineNuxtConfig } from 'nuxt'
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
buildModules: ['@nuxtjs/stylelint-module', '@nuxtjs/eslint-module'],
css: ['vuetify/styles'],
build: {
transpile: ['vuetify', '@apollo/client', 'ts-invariant/process']
},
vite: {
server: {
hmr: {
protocol: 'ws',
host: 'localhost'
}
}
}
}) nuxt3.dockerfile # Dockerfile
FROM node:16-alpine3.14
# create destination directory
RUN mkdir -p /usr/src/nuxt-app
WORKDIR /usr/src/nuxt-app
# update and install dependency
RUN apk update && apk upgrade
RUN apk add git
# copy the app, note .dockerignore
COPY package.json .
RUN yarn install
COPY . .
RUN yarn build
EXPOSE 3000
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000
CMD [ "yarn", "dev" ] docker-compose.dev.yml version: '3.9'
services:
nuxt3:
build:
context: .
dockerfile: nuxt3.dockerfile
ports:
- 3000:3000
- 24678:24678 |
The solution was to remove this config from the server: {
hmr: {
protocol: 'ws'
host: 'localhost'
}
} As long as you bind port The twist after that is to completely clear the cache of your browser as described in here: nuxt/nuxt#11956 |
+1 here. I have two exactly same configs for Nuxt (RC3) and pure Vite. Vite is working fine, Nuxt is not. Even if I set defineConfig({
server: {
host: '0.0.0.0',
hmr: {
clientPort: 443,
}
},
})
defineNuxtConfig({
vite: {
server: {
host: '0.0.0.0',
hmr: {
clientPort: 443,
},
}
}
}) |
Problem is not resolved in 3.0.0 RC6. Need to open 24678 port =( |
On Mac computer, adding port 24678 in docker compose works fine, but changing to a computer with linux pop os, it does not work. I must stop and boot my docker container to see some changes.
Firefox browser says it can't connect to 24678 port. |
export default defineNuxtConfig({
vite: {
server: {
watch: { usePolling: true }
}
}
}) I had the issue that my project did not refresh when updating my source code when working in devcontainer (with Docker Desktop / Win10). |
Is this issue still being solved? Do you have any solution? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@jaydrogers This is a module for nuxt 2. It sounds like you are running Nuxt 3 instead? |
This comment was marked as off-topic.
This comment was marked as off-topic.
I would recommend raising it in the issue you linked or in another one on nuxt/framework. Ideally with a reproduction so Pooya or I can investigate further. |
Versions
nuxt-vite: v0.1.1
nuxt: v2.15.7
Reproduction
To reproduce this error.
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.11",
"nuxt-vite": "^0.1.1",
"browser-env": "^3.2.5",
"eslint": "^4.19.1",
"eslint-plugin-vue": "^4.0.0",
"require-extension-hooks": "^0.3.2"
},
frontend:
build:
context: ./frontend
dockerfile: docker/Dockerfile.dev
volumes:
- "./frontend:/app/"
- "/app/node_modules"
ports:
- "3000:3000"
environment:
- API_URI=http://backend:8000/api
networks:
- main
FROM node:14.15.5
WORKDIR /app/
COPY . /app/
ENV SENTRY_DISABLED=true
ENV HOST 0.0.0.0
EXPOSE 3000
ENTRYPOINT ["sh", "docker/start_dev.sh"]
#!/bin/bash
npm rebuild node-sass
npm config set save-prefix=''
npm install
npm install --save nuxt
npm run dev
run docker compose up -d
Description
Page keeps refreshing when running in docker container.
buildModules: [
// https://go.nuxtjs.dev/typescript
'nuxt-vite',
],
build: {
/*
** Run ESLint on save
*/
},
vite: {
ssr: true,
server: {
fs: {
strict: false
}
}
}
}
The text was updated successfully, but these errors were encountered: