Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reload not working in Docker container #396

Open
2 tasks done
Gmanicus opened this issue Sep 1, 2024 · 0 comments
Open
2 tasks done

Hot reload not working in Docker container #396

Gmanicus opened this issue Sep 1, 2024 · 0 comments

Comments

@Gmanicus
Copy link

Gmanicus commented Sep 1, 2024

Describe the bug

I have used this plugin before and it works great, but I've really struggled to get the hot reload portion of it working in a Docker container.

I have a React + Typescript project that I launch in a container with a bind mount to the local files.

When the container starts, the checker works perfectly. However, when I make a code change, Vite updates properly, but the checker doesn't update. My guess: There are some issues with Vite hot reloading in a Docker container on Windows (the OS of my PC). You have to set the "chokidar" watcher usePolling option to true. I wonder if the same needs to happen here...

export default defineConfig({
    plugins: [
      tsconfigPaths(),
      react(),
      checker({
            typescript: true
      }),
      TanStackRouterVite()
    ],
    resolve: {
      extensions: ['.ts', '.tsx', '.jsx', '.js'],
      alias: {
        '~': path.resolve(__dirname, 'src'),
        '~bootstrap': path.resolve(__dirname, './node_modules/bootstrap')
      },
    },
    build: {
      outDir: './build'
    },
    server: {
      port: 80,
      host: 'client'
      proxy: {
        '/api': `http://server:3000`
      },
      hmr: true,
      watch: { usePolling: true }
    }
})

Reproduction

Attempt to run a Vite + React + Typescript app with the checker in a Docker container with hot reloading hmr: true watch: { usePolling: true } on a Windows machine?

Expected behavior

The checker should hot reload on file changes as expected.

System Info

Up-to-date

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant