web icon indicating copy to clipboard operation
web copied to clipboard

dev-server not updating on Windows WSL

Open matejhrachovina opened this issue 2 years ago • 3 comments

The dev-server does not update the build upon file change in Windows 11 WSL 2 (v 1.2.0.0). The initial page is built ok, but upon file changes, it still serves the files, that were built upon running the npm start command. Even manual refresh of the page doesn't help. I have read the documentation, set the --watch flag and the rootDir and basePath paths, but neither of those worked. Tested on a clean SPA project scaffolded with npm init @open-wc.

matejhrachovina avatar Apr 12 '23 09:04 matejhrachovina

One of my coworkers had this same issue. It turned out that he had cloned his repo into a "mounted" location (/mnt/c which is how you access the Windows C: drive in WSL). We fixed by cloning his repo into a subdirectory under home (~/workspace for example) instead.

Not sure if your issue is caused by a similar location issue, but I figured it was worth mentioning!

tannerstern avatar May 23 '23 17:05 tannerstern

I am also experiencing this issue with a dockerized environment running WDS for local development on windows

Matsuuu avatar Jan 19 '24 08:01 Matsuuu

Just commenting here in case someone runs into this:

After the above PR has been merged, and it's now released, you can use chokidar options to circumvent this problem


/** @type { import("@web/dev-server").DevServerConfig } */
export default {
    // nodeResolve: true,
  watch: true,
  appIndex: "index.html",
  chokidarOptions: {
    usePolling: true
  }
};```

Matsuuu avatar Mar 22 '24 12:03 Matsuuu