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

Add option to make watchContentBase recursive or expose chokidar options #1694

Closed
1 of 2 tasks
marcofugaro opened this issue Feb 27, 2019 · 3 comments
Closed
1 of 2 tasks

Comments

@marcofugaro
Copy link
Contributor

marcofugaro commented Feb 27, 2019

  • Operating System: OSX

  • Node Version: v11.7.0

  • NPM Version: 6.5.0

  • webpack Version: 4.29.5

  • webpack-dev-server Version: 3.2.1

  • This is a bug

  • This is a modification request

Code

I have a public folder like this

public/
├── assets
│   ├── image.png
│   ├── video.mp4
├── css
│   └── style.css
└── index.html

And my config like this

devServer: {
  publicPath: '/',
  contentBase: './public/',
  watchContentBase: true,
  // don't watch node_modules
  watchOptions: {
    ignored: /node_modules/,
  },
},

Actual Behavior

Right now the watchContentBase acts only on the root folder, because of this chokidar options:

Expected Behavior

I would like for watchContentBase: true, to trigger a reload whenever a file in my public folder changes.

It was also discussed in #1227, but I don't this is a good solution to start another chokidar instance. Plus this is a really common use-case.

It would be really useful to have an option recursive: true in the watchOptions: {}, or more simply a depth: undefined option which goes to override the default chokidar options.

I am willing to make a PR if we decide what direction to take.

@alexander-akait
Copy link
Member

Yep, we should avoid this limitation, feel free to send a PR with remove this depth. Question for depth: 0 in watchpack not related to contentBase option

@marcofugaro
Copy link
Contributor Author

Done!

@alexander-akait
Copy link
Member

Fixed #1697

khalwat added a commit to nystudio107/annotated-webpack-config that referenced this issue May 31, 2019
…ory [watchContentBase issue](webpack/webpack-dev-server#1694)

Signed-off-by: Andrew Welch <andrew@nystudio107.com>
khalwat added a commit to nystudio107/annotated-webpack-config that referenced this issue May 31, 2019
…ory [watchContentBase issue](webpack/webpack-dev-server#1694)

Signed-off-by: Andrew Welch <andrew@nystudio107.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants