Webpack: why express instead of webpack-dev-server

Created on 25 Jul 2017  路  6Comments  路  Source: vuejs-templates/webpack

Hi,I'm new to webpack and nearly know nothing about node, so it may be a stupid question.
I wonder why we use express as our server instead of webpack-dev-server.

Thanks a lot!

question

Most helpful comment

All 6 comments

@llwslc Sorry, I don'know if I really express clearly...Webpack-dev-server is a bulit-in server of webpack, but we use express in this template instead of use webpack-dev-server directly.I want to know why and what's the consideration of it.

Thank you very much for your reply!

@escawn webpack-dev-server uses express also: https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js

The custom dev-server.js file is pretty simple and easy to customize. They both use express.js behind the scenes.

@grantcarthew I think I nearly get the point. I'll study more detaill in source code.

Thanks a lot!

When we started this template, webpack-dev-server didn't have all the features /customization options that we would like it to have, so we decided to use webpack-dev-middleware & hot-middleware.

But webpack-dev-server has improved other the last couple of months so I guess we could switch to it just as well. But I haven't compared the two setups in detail yet. We will do that sometime, though.

@escawn: I refactored my project (built from the webpack vue template) to use webpack-dev-server and it seems to have the same functionality as the dev-server and dev-client scripts. I had to use the node API to run the webpack-dev-server in test/e2e/runner.js, but aside from that I just followed the webpack docs and deleted code when it worked.

Was this page helpful?
0 / 5 - 0 ratings