Reputation: 920
I have a question. It seems the webpack-dev-server
documentation only mentions watchContentBase option which watches the content base directory. But is it possible to use WDS
to also watch a glob pattern like ["./**/*.php"]
for file changes and reload the browser?
Currently I am using BrowserSync
to do this, but I feel this is redundant.
I found an internal method of WDS
.watch( <pattern> )
, but not sure how to insert this inside the webpack.config.js
Hope somebody can help.
Regards,
Upvotes: 0
Views: 184
Reputation: 36
First, thank you because your question was my answer - was trying to figure out where the server._watch method came from after seeing it in a tutorial project.
The way this method was used (successfully) in the tutorial was under the devServer.before method in webpack.config.js:
module.exports = {
devServer: {
before: (app, server) => {
server._watch('./app/**/*.html');
},
}
}
Upvotes: 1