You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
W> This option is deprecated in favor of [devServer.server](#devserverserver) option.
629
+
628
630
## devServer.https
629
631
630
632
`boolean``object`
@@ -706,6 +708,8 @@ module.exports = {
706
708
707
709
W> Don't specify `https.ca` and `https.cacert` options together, if specified `https.ca` will be used. `https.cacert` is deprecated and will be removed in the next major release.
708
710
711
+
W> This option is deprecated in favor of [devServer.server](#devserverserver) option.
712
+
709
713
## devServer.headers
710
714
711
715
`array``function``object`
@@ -1407,6 +1411,125 @@ module.exports = {
1407
1411
};
1408
1412
```
1409
1413
1414
+
## devServer.server
1415
+
1416
+
`'http' | 'https' | 'spdy'``object`
1417
+
1418
+
<Badgetext="v4.4.0+" />
1419
+
1420
+
Allows to set server and options (by default 'http').
1421
+
1422
+
**webpack.config.js**
1423
+
1424
+
```javascript
1425
+
module.exports= {
1426
+
//...
1427
+
devServer: {
1428
+
server:'http',
1429
+
},
1430
+
};
1431
+
```
1432
+
1433
+
Usage via the CLI:
1434
+
1435
+
```bash
1436
+
npx webpack serve --server-type http
1437
+
```
1438
+
1439
+
To serve over `HTTPS` with a self-signed certificate:
1440
+
1441
+
**webpack.config.js**
1442
+
1443
+
```javascript
1444
+
module.exports= {
1445
+
//...
1446
+
devServer: {
1447
+
server:'https',
1448
+
},
1449
+
};
1450
+
```
1451
+
1452
+
Usage via the CLI:
1453
+
1454
+
```bash
1455
+
npx webpack serve --server-type https
1456
+
```
1457
+
1458
+
To serve over `HTTP/2` using [spdy](https://www.npmjs.com/package/spdy) with a self-signed certificate:
1459
+
1460
+
**webpack.config.js**
1461
+
1462
+
```javascript
1463
+
module.exports= {
1464
+
//...
1465
+
devServer: {
1466
+
server:'spdy',
1467
+
},
1468
+
};
1469
+
```
1470
+
1471
+
Usage via the CLI:
1472
+
1473
+
```bash
1474
+
npx webpack serve --server-type spdy
1475
+
```
1476
+
1477
+
Use the object syntax to provide your own certificate:
It also allows you to set additional [TLS options](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) like `minVersion` and you can directly pass the contents of respective files:
0 commit comments