Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Adele Beitvashahi
Adele Beitvashahi

Posted on

     

How to setup dev containers in windows

If you are going to work with dev containers in Windows you need to realize that they will break HMR (hot module reload) and increase build time unless you put your code inside WSL instead of the windows filesystem.

How Dev Containers Work in Windows

Dev containers use Docker, which relies on WSL. When you spin up a dev container, VSCode starts a docker container in WSL, and mounts the files from windows (if they are stored there). This means changes have to cross the WSL-Windows environment. This tends to break HMR, because HMR relies on file change API of the host env, and the filesystem events don't travel well between different host environments.

code stored in Windows vs WSL

Correct setup for dev containers in Windows

1. Dev container setup in WSL

2. Clone repo inside the WSL filesystem

Now you should be able to do yarn && yarn dev inside WSL and HMR should work.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
shawk4 profile image
Kody
  • Joined

I appreciate the graphic. Very effective for getting the big picture here thank you.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I like to build stuff. Looking for work 👀My posts serve as documentation for future me for problems that I encounter and can't find good resources on.
  • Education
    Indiana University - Bloomington
  • Joined

More fromAdele Beitvashahi

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp