chore: upgrade webpack-dev-server to v4.5.0 (#5998)

* chore: upgrade webpack-dev-server to v4.5.0

* Fixes after review

* remove type assertion

Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Alexey Pyltsyn 2021-11-24 12:41:34 +03:00 committed by GitHub
parent 48fff3e66c
commit b31044dc8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View file

@ -86,7 +86,7 @@
"@types/semver": "^7.1.0", "@types/semver": "^7.1.0",
"@types/shelljs": "^0.8.6", "@types/shelljs": "^0.8.6",
"@types/wait-on": "^5.2.0", "@types/wait-on": "^5.2.0",
"@types/webpack-dev-server": "^4.1.0", "@types/webpack-dev-server": "^4.5.0",
"@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0", "@typescript-eslint/parser": "^5.4.0",
"concurrently": "^6.2.1", "concurrently": "^6.2.1",

View file

@ -118,7 +118,7 @@
"wait-on": "^6.0.0", "wait-on": "^6.0.0",
"webpack": "^5.61.0", "webpack": "^5.61.0",
"webpack-bundle-analyzer": "^4.4.2", "webpack-bundle-analyzer": "^4.4.2",
"webpack-dev-server": "^4.4.0", "webpack-dev-server": "^4.5.0",
"webpack-merge": "^5.8.0", "webpack-merge": "^5.8.0",
"webpackbar": "^5.0.0-3" "webpackbar": "^5.0.0-3"
}, },

View file

@ -8,7 +8,6 @@
import {normalizeUrl, posixPath} from '@docusaurus/utils'; import {normalizeUrl, posixPath} from '@docusaurus/utils';
import chalk = require('chalk'); import chalk = require('chalk');
import chokidar from 'chokidar'; import chokidar from 'chokidar';
import HtmlWebpackPlugin from 'html-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path'; import path from 'path';
import {debounce} from 'lodash'; import {debounce} from 'lodash';
@ -114,6 +113,7 @@ export default async function start(
? (cliOptions.poll as number) ? (cliOptions.poll as number)
: undefined, : undefined,
}; };
const httpsConfig = getHttpsConfig();
const fsWatcher = chokidar.watch(pathsToWatch, { const fsWatcher = chokidar.watch(pathsToWatch, {
cwd: siteDir, cwd: siteDir,
ignoreInitial: true, ignoreInitial: true,
@ -177,7 +177,6 @@ export default async function start(
errors: true, errors: true,
}, },
}, },
https: getHttpsConfig(),
headers: { headers: {
'access-control-allow-origin': '*', 'access-control-allow-origin': '*',
}, },
@ -197,6 +196,15 @@ export default async function start(
...{pollingOptions}, ...{pollingOptions},
}, },
})), })),
...(httpsConfig && {
server:
typeof httpsConfig === 'object'
? {
type: 'https',
options: httpsConfig,
}
: 'https',
}),
historyApiFallback: { historyApiFallback: {
rewrites: [{from: /\/*/, to: baseUrl}], rewrites: [{from: /\/*/, to: baseUrl}],
}, },

View file

@ -4674,7 +4674,7 @@
"@types/webpack" "^4" "@types/webpack" "^4"
http-proxy-middleware "^1.0.0" http-proxy-middleware "^1.0.0"
"@types/webpack-dev-server@^4.1.0": "@types/webpack-dev-server@^4.5.0":
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-4.5.0.tgz#52a983de97db81a38b7309a8cf8a730c3e02f28e" resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-4.5.0.tgz#52a983de97db81a38b7309a8cf8a730c3e02f28e"
integrity sha512-HMb6pZPANObue3LwbdpQLWzQyF9O0wntiPyXj4vGutlAbNKTXH4hDCHaZyfvfZDmFn+5HprrWHm1TGt3awNr/A== integrity sha512-HMb6pZPANObue3LwbdpQLWzQyF9O0wntiPyXj4vGutlAbNKTXH4hDCHaZyfvfZDmFn+5HprrWHm1TGt3awNr/A==
@ -20417,7 +20417,7 @@ webpack-dev-middleware@^5.2.1:
range-parser "^1.2.1" range-parser "^1.2.1"
schema-utils "^4.0.0" schema-utils "^4.0.0"
webpack-dev-server@^4.4.0: webpack-dev-server@^4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.5.0.tgz#614b5112cfa4730a4801bb4ddebb3be5b0d70497" resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.5.0.tgz#614b5112cfa4730a4801bb4ddebb3be5b0d70497"
integrity sha512-Ss4WptsUjYa+3hPI4iYZYEc8FrtnfkaPrm5WTjk9ux5kiCS718836srs0ppKMHRaCHP5mQ6g4JZGcfDdGbCjpQ== integrity sha512-Ss4WptsUjYa+3hPI4iYZYEc8FrtnfkaPrm5WTjk9ux5kiCS718836srs0ppKMHRaCHP5mQ6g4JZGcfDdGbCjpQ==