From 86877d0f9fa2218cfb9453a811fc1c3044487735 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sat, 23 May 2026 12:37:08 -0500 Subject: [PATCH 1/2] feat: update client bundle to target ES2024 and remove support for older browsers --- .changeset/client-bundle-es2024.md | 5 +++ babel.config.js | 19 ++--------- client-src/webpack.config.js | 21 +----------- package-lock.json | 54 ------------------------------ package.json | 3 -- tsconfig.client.json | 2 +- 6 files changed, 9 insertions(+), 95 deletions(-) create mode 100644 .changeset/client-bundle-es2024.md diff --git a/.changeset/client-bundle-es2024.md b/.changeset/client-bundle-es2024.md new file mode 100644 index 0000000000..8f658098b7 --- /dev/null +++ b/.changeset/client-bundle-es2024.md @@ -0,0 +1,5 @@ +--- +"webpack-dev-server": major +--- + +The injected client bundle now targets ES2024. Browsers without native ES module support (IE 11, Edge legacy, Safari < 10.1, Chrome < 61, Firefox < 60) are no longer supported. diff --git a/babel.config.js b/babel.config.js index 49ff61255b..d935d0a3f2 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,6 +2,7 @@ export default (api) => { api.cache(true); return { + ignore: ["client/**", "node_modules/**"], presets: [ [ "@babel/preset-env", @@ -9,26 +10,10 @@ export default (api) => { modules: false, targets: { esmodules: true, - node: "0.12", + node: "22.15.0", }, }, ], ], - plugins: ["@babel/plugin-transform-object-assign"], - env: { - test: { - presets: [ - [ - "@babel/preset-env", - { - targets: { - node: "22.15.0", - }, - }, - ], - ], - plugins: ["@babel/plugin-transform-runtime"], - }, - }, }; }; diff --git a/client-src/webpack.config.js b/client-src/webpack.config.js index e806f668c2..efdf2941c7 100644 --- a/client-src/webpack.config.js +++ b/client-src/webpack.config.js @@ -21,7 +21,7 @@ const baseForModules = { path: path.resolve(__dirname, "../client/modules"), ...library, }, - target: ["web", "es5"], + target: ["web", "es2024"], module: { rules: [ { @@ -42,26 +42,7 @@ export default [ output: { filename: "logger/index.js", }, - module: { - rules: [ - { - test: /\.js$/, - use: [ - { - loader: "babel-loader", - options: { - plugins: ["@babel/plugin-transform-object-assign"], - }, - }, - ], - }, - ], - }, plugins: [ - new webpack.DefinePlugin({ - Symbol: - '(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })', - }), new webpack.NormalModuleReplacementPlugin( /^tapable$/, path.join(__dirname, "modules/logger/tapable.js"), diff --git a/package-lock.json b/package-lock.json index 821e3ffe7e..64298a9802 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,10 +42,7 @@ "@babel/cli": "^7.28.6", "@babel/core": "^7.29.0", "@babel/eslint-parser": "^7.28.6", - "@babel/plugin-transform-object-assign": "^7.27.1", - "@babel/plugin-transform-runtime": "^7.29.0", "@babel/preset-env": "^7.29.2", - "@babel/runtime": "^7.29.2", "@changesets/cli": "^2.29.8", "@changesets/get-github-info": "^0.8.0", "@commitlint/cli": "^19.5.0", @@ -1321,22 +1318,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-assign": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.27.1.tgz", - "integrity": "sha512-LP6tsnirA6iy13uBKiYgjJsfQrodmlSrpZModtlo1Vk8sOO68gfo7dfA9TGJyEgxTiO7czK4EGZm8FJEZtk4kQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-object-rest-spread": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.28.6.tgz", @@ -1523,27 +1504,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-runtime": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.29.0.tgz", - "integrity": "sha512-jlaRT5dJtMaMCV6fAuLbsQMSwz/QkvaHOHOSXRitGGwSpR1blCY4KUKoyP2tYO8vJcqYe8cEj96cqSztv3uF9w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-plugin-utils": "^7.28.6", - "babel-plugin-polyfill-corejs2": "^0.4.14", - "babel-plugin-polyfill-corejs3": "^0.13.0", - "babel-plugin-polyfill-regenerator": "^0.6.5", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-shorthand-properties": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz", @@ -6064,20 +6024,6 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.13.0.tgz", - "integrity": "sha512-U+GNwMdSFgzVmfhNm8GJUX88AadB3uo9KpJqS3FaqNIPKgySuvMb+bHPsOmmuWyIcuqZj/pzt1RUIUZns4y2+A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.5", - "core-js-compat": "^3.43.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/babel-plugin-polyfill-regenerator": { "version": "0.6.8", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.8.tgz", diff --git a/package.json b/package.json index cec551cf2d..24df0cedb7 100644 --- a/package.json +++ b/package.json @@ -75,10 +75,7 @@ "@babel/cli": "^7.28.6", "@babel/core": "^7.29.0", "@babel/eslint-parser": "^7.28.6", - "@babel/plugin-transform-object-assign": "^7.27.1", - "@babel/plugin-transform-runtime": "^7.29.0", "@babel/preset-env": "^7.29.2", - "@babel/runtime": "^7.29.2", "@changesets/cli": "^2.29.8", "@changesets/get-github-info": "^0.8.0", "@commitlint/cli": "^19.5.0", diff --git a/tsconfig.client.json b/tsconfig.client.json index 4bd07e7495..5cbd3ece32 100644 --- a/tsconfig.client.json +++ b/tsconfig.client.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "esnext", - "lib": ["es5", "dom", "webworker", "es2022.error"], + "lib": ["es2024", "dom", "webworker"], "module": "nodenext", "moduleResolution": "nodenext", "allowJs": true, From 5c12aa74867b5f7b7ab81bb692f7420510b8f3fc Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sat, 23 May 2026 12:46:53 -0500 Subject: [PATCH 2/2] refactor: remove getCodePoint function and use String.prototype.codePointAt directly --- client-src/overlay.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/client-src/overlay.js b/client-src/overlay.js index 6003b6194b..7c7a552ca3 100644 --- a/client-src/overlay.js +++ b/client-src/overlay.js @@ -5,19 +5,6 @@ import ansiHTML from "ansi-html-community"; /** @typedef {import("./index.js").EXPECTED_ANY} EXPECTED_ANY */ -/** - * @type {(input: string, position: number) => number | undefined} - */ -// @ts-expect-error -const getCodePoint = String.prototype.codePointAt - ? // @ts-expect-error - (input, position) => input.codePointAt(position) - : (input, position) => - (input.charCodeAt(position) - 0xd800) * 0x400 + - input.charCodeAt(position + 1) - - 0xdc00 + - 0x10000; - /** * @param {string} macroText macro text * @param {RegExp} macroRegExp macro reg exp @@ -70,7 +57,7 @@ function encode(text) { let result = references[/** @type {keyof typeof references} */ (input)]; if (!result) { const code = - input.length > 1 ? getCodePoint(input, 0) : input.charCodeAt(0); + input.length > 1 ? input.codePointAt(0) : input.charCodeAt(0); result = `&#${code};`; } return result;