1

I'm finding that webpack-serve is taking a lot longer to build than webpack-dev-server. I have both of them set up at the same time, as shown in the image below. -serve takes twice as long for the initial build and about 10x as long for a simple hot build. They are both set up in the same way, using a proxy to serve up the non-webpack'd content from the real server. Other than that, it's all the default settings.

If webpack-serve is supposed to be "lightning fast" compared to wds, why is mine taking so much longer?

webpack-serve vs webpack-dev-server

Justin
  • 161
  • 1
  • 8
  • I forgot to mention: Another issue I'm having is that with WDS, the page is hot-reloaded (without refreshing), but with webpack-serve, the it logs "Cannot apply update. Please refresh the page.", and then of course it auto-refreshes the whole page. – Justin Jun 22 '18 at 14:47

2 Answers2

4

SOLVED: mode was set to production instead of development (and therefore UglifyJSPlugin was wasting all the time on each build).

I thought I had it set up right, using mode: process.env.WEBPACK_SERVE ? 'development' : 'production' in my main webpack.js config file. However, because I wasn't using the webpack-serve CLI, it wasn't actually setting that env variable. (I have it setup to use the serve() function)

Justin
  • 161
  • 1
  • 8
1

A quick way to solve the issue is to add the --mode development flag.

webpack serve --mode development
spencer.sm
  • 19,173
  • 10
  • 77
  • 88