Skip to content

Commit

Permalink
chore: Updated webpack dev server dependency (#179)
Browse files Browse the repository at this point in the history
* Updated webpack dev server dependency

* Added changeset file

* Fix CI

* Fix CI
  • Loading branch information
patricklafrance authored Feb 14, 2024
1 parent 3c17c73 commit 61d3721
Show file tree
Hide file tree
Showing 16 changed files with 613 additions and 546 deletions.
11 changes: 11 additions & 0 deletions .changeset/light-worms-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@workleap/browserslist-config": patch
"@workleap/stylelint-configs": patch
"@workleap/postcss-configs": patch
"@workleap/webpack-configs": patch
"@workleap/eslint-plugin": patch
"@workleap/tsup-configs": patch
"@workleap/swc-configs": patch
---

Updated dependencies.
2 changes: 1 addition & 1 deletion docs/webpack/configure-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default defineDevConfig(swcConfig, {

### `https`

- **Type**: `boolean`
- **Type**: `boolean` | `ServerOptions`
- **Default**: `false`

Set webpack DevServer [https option](https://webpack.js.org/configuration/dev-server/#devserverhttps) and format webpack [publicPath option](https://webpack.js.org/configuration/output/#outputpublicpath) accordingly.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/parser": "7.0.1",
"@workleap/eslint-plugin": "workspace:*",
"@workleap/typescript-configs": "workspace:*",
"eslint": "8.56.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/browserslist-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@workleap/eslint-plugin": "workspace:*",
"@workleap/tsup-configs": "workspace:*",
"@workleap/typescript-configs": "workspace:*",
"tsup": "8.0.1"
"tsup": "8.0.2"
},
"publishConfig": {
"access": "public",
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"build": "tsup"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-jest": "^27.8.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-react": "^7.33.2",
Expand All @@ -62,21 +62,21 @@
}
},
"devDependencies": {
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/helpers": "0.5.6",
"@swc/jest": "0.2.36",
"@types/eslint": "8.56.2",
"@types/estree": "1.0.5",
"@types/jest": "29.5.12",
"@types/node": "20.11.17",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/parser": "7.0.1",
"@workleap/swc-configs": "workspace:*",
"@workleap/tsup-configs": "workspace:*",
"@workleap/typescript-configs": "workspace:*",
"eslint": "8.56.0",
"jest": "29.7.0",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/postcss-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"postcss": ">=8.4.6"
},
"devDependencies": {
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/helpers": "0.5.6",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
Expand All @@ -50,7 +50,7 @@
"jest": "29.7.0",
"postcss": "8.4.35",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@workleap/typescript-configs": "workspace:*",
"prettier": "3.2.5",
"stylelint": "16.2.1",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/swc-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"build": "tsup"
},
"devDependencies": {
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/helpers": "0.5.6",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
Expand All @@ -45,7 +45,7 @@
"browserslist": "4.22.3",
"jest": "29.7.0",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/tsup-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"typescript": "*"
},
"devDependencies": {
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/helpers": "0.5.6",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
Expand All @@ -49,7 +49,7 @@
"@workleap/typescript-configs": "workspace:*",
"jest": "29.7.0",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"publishConfig": {
Expand Down
6 changes: 3 additions & 3 deletions packages/webpack-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@svgr/core": "8.1.0",
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/helpers": "0.5.6",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
Expand All @@ -59,10 +59,10 @@
"postcss": "8.4.35",
"postcss-load-config": "5.0.3",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsup": "8.0.2",
"typescript": "5.3.3",
"webpack": "5.90.1",
"webpack-dev-server": "4.15.1"
"webpack-dev-server": "5.0.1"
},
"dependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
Expand Down
10 changes: 7 additions & 3 deletions packages/webpack-configs/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import path from "node:path";
import { fileURLToPath } from "node:url";
import type { Configuration as WebpackConfig } from "webpack";
import webpack from "webpack";
import type { ServerOptions } from "webpack-dev-server";
import { applyTransformers, type WebpackConfigTransformer } from "./transformers/applyTransformers.ts";
import { isNil, isObject } from "./utils.ts";

// Add the "devServer" prop to WebpackConfig typings.
// Add the "devServer" option to WebpackConfig typings.
import "webpack-dev-server";

// Aliases
Expand Down Expand Up @@ -43,7 +44,7 @@ export function defineFastRefreshPluginConfig(options: ReactRefreshPluginOptions

export interface DefineDevConfigOptions {
entry?: string;
https?: NonNullable<WebpackConfig["devServer"]>["https"];
https?: boolean | ServerOptions | undefined;
host?: string;
port?: number;
publicPath?: `${string}/` | "auto";
Expand Down Expand Up @@ -116,12 +117,15 @@ export function defineDevConfig(swcConfig: SwcConfig, options: DefineDevConfigOp
// According to the Fast Refresh plugin documentation, hot should be "true" to enable Fast Refresh:
// https://github.com/pmmmwh/react-refresh-webpack-plugin#usage.
hot: true,
https,
host,
port,
historyApiFallback: true,
client: (overlay === false || fastRefresh) ? {
overlay: false
} : undefined,
server: https ? {
type: "https",
options: isObject(https) ? https : undefined
} : undefined
},
entry,
Expand Down
6 changes: 3 additions & 3 deletions packages/webpack-configs/tests/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Config as SwcConfig } from "@swc/core";
import { defineDevConfig as defineSwcConfig } from "@workleap/swc-configs";
import HtmlWebpackPlugin from "html-webpack-plugin";
import type { Configuration, FileCacheOptions, RuleSetRule } from "webpack";
import type { ClientConfiguration } from "webpack-dev-server";
import type { ClientConfiguration, ServerConfiguration } from "webpack-dev-server";
import { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from "../src/dev.ts";
import type { WebpackConfigTransformer } from "../src/transformers/applyTransformers.ts";
import { findModuleRule, matchAssetModuleType, matchLoaderName } from "../src/transformers/moduleRules.ts";
Expand All @@ -26,15 +26,15 @@ test("when https is enabled, the dev server is configured for https", () => {
https: true
});

expect(result.devServer?.https).toBe(true);
expect((result.devServer?.server as ServerConfiguration).type).toBe("https");
});

test("when https is disabled, the dev server is not configured for https", () => {
const result = defineDevConfig(SwcConfig, {
https: false
});

expect(result.devServer?.https).toBe(false);
expect(result.devServer?.server).toBeUndefined();
});

test("when https is enabled, the public path starts with https", () => {
Expand Down
Loading

0 comments on commit 61d3721

Please sign in to comment.