Why is my webpack-serve building so much SLOWER than webpack-dev-server?

3.5k Views Asked by At

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

2

There are 2 best solutions below

0
On

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)

0
On

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

webpack serve --mode development