Skip to content

Commit

Permalink
#267 frontend: disable hmr in dockerized environments
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolkenfarmer committed Jul 11, 2024
1 parent e66f708 commit 7e22177
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ COPY . .
ENV VITE_RUN_CONFIG=${VITE_RUN_CONFIG}
ENV VITE_SERVER_URL_HTTP=${VITE_SERVER_URL_HTTP}
ENV VITE_SERVER_URL_WS=${VITE_SERVER_URL_WS}
ENV IS_DOCKER=TRUE
ENV PORT=5173
EXPOSE 5173
RUN if [ "$VITE_RUN_CONFIG" = "prod" ]; then npm run build-only; fi
Expand Down
8 changes: 2 additions & 6 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ export default defineConfig({
'process.env': process.env
},
server: {
// in order for hot module replacement to not throw an error inside the docker container
// (localhost would resolve to the container and not the host)
hmr: {
host: 'ws://host.docker.internal',
port: 80
}
// we do not need hmr in docker images + default address would not work (host: 'host.docker.internal' would be needed)
hmr: !process.env.IS_DOCKER
}
})

0 comments on commit 7e22177

Please sign in to comment.