Skip to content

Commit

Permalink
#267 frontend: resolve hmr error when running dockerized in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolkenfarmer committed Jul 11, 2024
1 parent 194c090 commit e66f708
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 0 additions & 7 deletions frontend/cypress/e2e/pass-through.cy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
describe('pass-through tests', () => {
beforeEach(() => {
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('Failed to construct \'WebSocket\'')) {
// Ignore weird WebSocket construction error - only occurs when using Docker and does not affect the functionality of the app
console.log('Caught WebSocket construction error: ' + err.message)
return false
}
})
cy.visit('http://localhost/')
})

Expand Down
10 changes: 9 additions & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ export default defineConfig({
},
envDir: './',
envPrefix: 'VITE_',
define: {
define: { // in order for env variables to be reliably available in the docker container
'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
}
}
})

0 comments on commit e66f708

Please sign in to comment.