Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the replacement for webpack-dev-server in Webpack 4?

I've noticed that installing webpack-dev-server@webpack/webpack#next actually installs webpack (without any warning). However, there's no webpack-dev-server executable any more.

Is there a replacement for this in Webpack 4, or do I need a separate web server?

It was really convenient to quickly spin up a web server with hot reloading. What's the recommended way to do that in Webpack 4?

(Why I'm bothering with Webpack 4 at all? Because it supports native .mjs modules)

like image 340
Dan Dascalescu Avatar asked Jan 20 '18 13:01

Dan Dascalescu


People also ask

Do you need webpack-dev-server?

And if I want to use react-hot-loader, is the webpack-dev-server necessary? Nope, it works on top of Webpack's hot module replacement interface. You can create your own 'hot server' if you want.

What can I use instead of a webpack?

There are some alternatives to Webpack that provide the same functionality as webpack. These alternatives are gulp, babel, parcel, browserify, grunt, npm, and requireJS.

Where is webpack-dev-server?

webpack-dev-server serves bundled files from the directory defined in output. path , i.e., files will be available under http://[devServer.host]:[devServer.port]/[output.publicPath]/[output.filename]


1 Answers

Today were released webpack v4.0.0 and webpack-dev-server v3.0.0

Just as Shaknar said, you just need to install the latest versions (including webpack-cli):

yarn add webpack webpack-cli webpack-dev-server --dev

You can also check this webpack-demo project I made for a meetup last week.

like image 131
Carloluis Avatar answered Jan 05 '23 03:01

Carloluis