Justin
Justin

Reputation: 161

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

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

Upvotes: 1

Views: 3906

Answers (2)

spencer.sm
spencer.sm

Reputation: 20526

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

webpack serve --mode development

Upvotes: 1

Justin
Justin

Reputation: 161

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)

Upvotes: 4

Related Questions