Imabi
Imabi

Reputation: 1

Webpack Watcher Error: "EISDIR: illegal operation on a directory" with WSL2 and Docker paths

I am working on a WooCommerce Storefront child theme and using Webpack for bundling. My development environment consists of DevKinsta, which relies on Docker, installed through WSL2. To resolve issues with npm not handling WSL paths properly, I mapped my project to drive Z.

Now, npm and Webpack seem to work fine, but when I run webpack --watch or use Webpack Dev Server, I encounter the following errors:

Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public\badspiegel\wp-content\themes\storefront-child\src\js'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public\badspiegel\wp-content\themes\storefront-child'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public\badspiegel\wp-content\themes'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public\badspiegel\wp-content'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public\badspiegel'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta\public'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes\DevKinsta'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker\volumes'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data\docker'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\data'
Watchpack Error (watcher): Error: EISDIR: illegal operation on a directory, watch 'Z:\'

Webpack seems to be attempting to watch higher-level paths, all the way up to Z:\data, which I don't want. It also treats directories as if they were files, resulting in the EISDIR errors.

My Webpack config file is located at:

Z:\data\docker\volumes\DevKinsta\public\onlineshop\wp-content\themes\storefront-child\webpack.config.js

I expected Webpack to only watch the relevant directories like src, fonts, and scss inside the theme. I have tried different Webpack configurations, but the issue persists. I'm wondering if this problem is related to how Webpack handles paths in a Docker + WSL2 setup.

Why is Webpack trying to watch these higher-level paths, and how can I configure it to only watch the directories I need? Is Webpack treating directories as files in this case, and what could be causing this behavior?

Upvotes: 0

Views: 66

Answers (0)

Related Questions