Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
Expand Down Expand Up @@ -52,14 +51,14 @@ There are two main, recommended methods of using the module:

### With the CLI

The easiest way to use it is with the CLI. In the directory where your
The easiest way to use it is with the [webpack CLI](https://webpack.js.org/api/cli/). In the directory where your
`webpack.config.js` is, run:

```console
node_modules/.bin/webpack-dev-server
node_modules/.bin/webpack serve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npx webpack serve

Copy link
Contributor Author

@ylemkimon ylemkimon Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npx could use the globally installed module, which would lead to errors. I think this was to demonstrate that one should use the local module. Binaries can be installed in other locations than node_modules/.bin, but those who do that would be advanced users.

```

_**Note**: Many CLI options are available with `webpack-dev-server`. Explore this [link](https://webpack.js.org/configuration/dev-server/)._
_**Note**: Many CLI options are available with `webpack serve`. Explore this [link](https://webpack.js.org/configuration/dev-server/)._

### With NPM Scripts

Expand All @@ -69,7 +68,7 @@ script as such:

```json
"scripts": {
"start:dev": "webpack-dev-server"
"start:dev": "webpack serve"
}
```

Expand Down Expand Up @@ -144,8 +143,6 @@ This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/
[npm-url]: https://npmjs.com/package/webpack-dev-server
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack/webpack-dev-server.svg
[deps-url]: https://david-dm.org/webpack/webpack-dev-server
[tests]: https://github.com/webpack/webpack-dev-server/workflows/webpack-dev-server/badge.svg
[tests-url]: https://github.com/webpack/webpack-dev-server/actions?query=workflow%3Awebpack-dev-server
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
Expand Down
6 changes: 1 addition & 5 deletions examples/api/middleware/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ const WebpackDevServer = require('../../../lib/Server');
const webpackConfig = require('./webpack.config');

const compiler = Webpack(webpackConfig);
const devServerOptions = Object.assign({}, webpackConfig.devServer, {
stats: {
colors: true,
},
});
const devServerOptions = webpackConfig.devServer;
const server = new WebpackDevServer(compiler, devServerOptions);

server.listen(8080, '127.0.0.1', () => {
Expand Down
3 changes: 3 additions & 0 deletions examples/api/middleware/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ module.exports = setup({
output: {
filename: 'bundle.js',
},
stats: {
colors: true,
},
});
3 changes: 0 additions & 3 deletions examples/api/simple/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const webpackConfig = require('./webpack.config');
const compiler = Webpack(webpackConfig);
const devServerOptions = Object.assign({}, webpackConfig.devServer, {
open: true,
stats: {
colors: true,
},
});
const server = new WebpackDevServer(compiler, devServerOptions);

Expand Down
3 changes: 3 additions & 0 deletions examples/api/simple/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ module.exports = setup({
output: {
filename: 'bundle.js',
},
stats: {
colors: true,
},
});
50 changes: 0 additions & 50 deletions examples/cli/listen-socket/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions examples/cli/listen-socket/check-socket.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/cli/listen-socket/webpack.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/cli/open-page-multiple/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: Open Page Option (Multiple)

```console
npm run webpack-dev-server -- --open-page example1.html,example2.html
npm run webpack-dev-server -- --open --open-page example1.html --open-page example2.html
```

Some applications may consist of multiple pages. During development it may
Expand Down
4 changes: 2 additions & 2 deletions examples/cli/open-page-multiple/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = [
}),
],
}),
setup({
{
context: __dirname,
entry: './app2.js',
output: {
Expand All @@ -33,5 +33,5 @@ module.exports = [
title: 'Open Page (Multiple) / Example / Page 2',
}),
],
}),
},
];
2 changes: 1 addition & 1 deletion examples/cli/open-page/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CLI: Open Page Option

```console
npm run webpack-dev-server -- --open-page example.html#page1
npm run webpack-dev-server -- --open --open-page example.html#page1
```

Some applications may consist of multiple pages. During development it may
Expand Down
18 changes: 0 additions & 18 deletions examples/cli/overlay/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions examples/cli/overlay/app.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/cli/overlay/webpack.config.js

This file was deleted.

16 changes: 0 additions & 16 deletions examples/cli/stdin/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions examples/cli/stdin/app.js

This file was deleted.

6 changes: 0 additions & 6 deletions examples/cli/stdin/webpack.config.js

This file was deleted.

6 changes: 0 additions & 6 deletions examples/cli/watch-content-base/app.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Watching a single directory

```console
npm run webpack-dev-server -- --content-base assets --watch-content-base --open
npm run webpack-dev-server -- --static assets --open
```

### What Should Happen
Expand All @@ -20,13 +20,13 @@ npm run webpack-dev-server -- --content-base assets --watch-content-base --open
module.exports = {
/* ... */
devServer: {
contentBase: ['assets', 'css'],
static: ['assets', 'css'],
},
};
```

```console
npm run webpack-dev-server -- --watch-content-base --open
npm run webpack-dev-server -- --open
```

### What Should Happen
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module.exports = setup({
context: __dirname,
entry: './app.js',
devServer: {
contentBase: ['assets', 'css'],
static: ['assets', 'css'],
},
});
4 changes: 2 additions & 2 deletions examples/general/config-array/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = [
],
},
}),
setup({
{
context: __dirname,
entry: './app.js',
output: {
Expand All @@ -44,5 +44,5 @@ module.exports = [
optimization: {
minimize: true,
},
}),
},
];