Skip to content

Commit d5ee0c3

Browse files
author
Alexey Ivanov
committed
Refactor webpack configuration for dev server
The webpack configuration has been refactored for a more accurate typing. The interface 'ConfigurationDevServer' was renamed to 'WebpackDevServerConfiguration', and its 'devServer' property type has been updated from 'any' to 'DevServerConfiguration' from 'webpack-dev-server'. The variable 'config' now uses the updated interface 'WebpackDevServerConfiguration'.
1 parent 7e431a5 commit d5ee0c3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webpack.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
33
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
44
import ESLintPlugin from 'eslint-webpack-plugin';
55
import { Configuration, HotModuleReplacementPlugin } from 'webpack';
6+
import { Configuration as DevServerConfiguration } from 'webpack-dev-server';
67

7-
interface ConfigurationDevServer extends Configuration {
8-
devServer?: any;
8+
interface WebpackDevServerConfiguration extends Configuration {
9+
devServer?: DevServerConfiguration;
910
}
1011

1112
const isProd = process.env.NODE_ENV === "production";
1213

13-
const config: ConfigurationDevServer = {
14+
const config: WebpackDevServerConfiguration = {
1415
mode: isProd ? 'production' : 'development',
1516
output: {
1617
path: path.resolve(__dirname, 'build'),

0 commit comments

Comments
 (0)