Aaron Jensen
Aaron Jensen

Reputation: 6060

webpack-dev-middleware compiles twice on boot

With the same webpack.config.js, webpack-dev-server runs a compile once on boot, but my webpack-dev-middleware setup compiles twice immediately upon startup.

I've added some logging in chokidar to make sure that a file change isn't happening and it doesn't appear to be. Any ideas on how to tell what is triggering the second compile?

Upvotes: 1

Views: 910

Answers (1)

Aaron Jensen
Aaron Jensen

Reputation: 6060

My logging for file watching was in the wrong place. It was actually file changes that I kick off right before starting the dev server. I'm not sure how to make it less sensitive, but that's a different issue.

For posterity, to add logging to find out what changed, I manually edited node_modules/watchpack/lib/watchpack.js and added a console.log(file) within the watcher.on("change"...

Upvotes: 2

Related Questions