Skip to content

Commit 234fd07

Browse files
committed
get off of legacy babel packages and onto the renamed maintained ones. respect the brwoserlist for transpilation, rather than duplicating it implicitly with manual transpile rules.
1 parent 673dda2 commit 234fd07

File tree

8 files changed

+47
-277
lines changed

8 files changed

+47
-277
lines changed

admin/babel.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
module.exports = {
33
sourceMaps: true,
44
presets: [
5-
"@babel/react",
5+
"@babel/preset-react",
66
[
7-
"@babel/env",
7+
"@babel/preset-env",
88
{
99
// Don't inject core-js polyfills automatically
1010
useBuiltIns: false,
1111
loose: true
1212
}
1313
],
14-
"@babel/typescript"
14+
"@babel/preset-typescript"
1515
],
1616
plugins: [
1717
// TODO: When i18n build pipeline is finished move to: [ "formatjs", { "removeDefaultMessage": true } ]
1818
"formatjs",
1919
// Private fields/methods not yet supported in Safari 15 (2012 MacBook and iPhone 7, added in Safari 16.4)
2020
// Other supported browser all have this as native: Chrome 91 (Oculus Go), Firefox/Gecko 116 (Wolvic HTC Vive)
21+
["@babel/plugin-transform-class-properties", { loose: true }],
2122
["@babel/plugin-transform-private-property-in-object", { loose: true }],
2223
["@babel/plugin-transform-private-methods", { loose: true }]
2324
]

admin/package-lock.json

Lines changed: 18 additions & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@
4747
"devDependencies": {
4848
"@babel/core": "^7.28.3",
4949
"@babel/eslint-parser": "^7.28.0",
50-
"@babel/plugin-proposal-class-properties": "^7.18.6",
51-
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
52-
"@babel/plugin-proposal-optional-chaining": "7.18.9",
53-
"@babel/plugin-proposal-private-methods": "^7.18.6",
54-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
50+
"@babel/plugin-transform-class-properties": "^7.26.0",
51+
"@babel/plugin-transform-private-methods": "^7.26.0",
52+
"@babel/plugin-transform-private-property-in-object": "^7.26.0",
5553
"@babel/polyfill": "^7.4.4",
5654
"@babel/preset-env": "^7.28.3",
5755
"@babel/preset-react": "^7.27.1",
@@ -90,7 +88,7 @@
9088
"source-map-support": "^0.5.21",
9189
"storybook": "^9.1.10",
9290
"style-loader": "^3.3.1",
93-
"typescript": "^5.9.2",
91+
"typescript": "^5.9.3",
9492
"url-loader": "^4.1.1",
9593
"webpack": "^5.89.0",
9694
"webpack-cli": "^5.1.0",

admin/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ module.exports = (env, argv) => {
137137
filename: "assets/js/[name]-[chunkhash].js",
138138
publicPath: process.env.BASE_ASSETS_PATH || ""
139139
},
140-
target: ["web", "es2020"], // use es2020 for modern browsers as defined in browserslistrc
140+
target: ["web", "browserslist"], // defer to .browserslistrc for output targets
141141
devtool: argv.mode === "production" ? "source-map" : "inline-source-map",
142142
devServer: {
143143
client: {

babel.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = {
22
sourceMaps: true,
33
presets: [
4-
"@babel/react",
4+
"@babel/preset-react",
55
[
6-
"@babel/env",
6+
"@babel/preset-env",
77
{
88
// targets are defined in .browserslistrc
99
useBuiltIns: "usage",
@@ -66,15 +66,15 @@ module.exports = {
6666
debug: false
6767
}
6868
],
69-
"@babel/typescript"
69+
"@babel/preset-typescript"
7070
],
7171
plugins: [
7272
// TODO: When i18n build pipeline is finished move to: [ "formatjs", { "removeDefaultMessage": true } ]
7373
"formatjs",
7474
// Private fields/methods not yet supported in Safari 15 (2012 MacBook and iPhone 7, added in Safari 16.4)
7575
// Other supported browser all have this as native: Chrome 91 (Oculus Go), Firefox/Gecko 116 (Wolvic HTC Vive)
76-
["@babel/plugin-proposal-class-properties", { loose: true }],
77-
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
78-
["@babel/plugin-proposal-private-methods", { loose: true }]
76+
["@babel/plugin-transform-class-properties", { loose: true }],
77+
["@babel/plugin-transform-private-property-in-object", { loose: true }],
78+
["@babel/plugin-transform-private-methods", { loose: true }]
7979
]
8080
};

package-lock.json

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@
152152
"devDependencies": {
153153
"@babel/core": "^7.28.3",
154154
"@babel/eslint-parser": "^7.28.0",
155-
"@babel/plugin-proposal-class-properties": "^7.18.6",
156-
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
157-
"@babel/plugin-proposal-optional-chaining": "7.18.9",
158-
"@babel/plugin-proposal-private-methods": "^7.18.6",
159-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
155+
"@babel/plugin-transform-class-properties": "^7.26.0",
156+
"@babel/plugin-transform-private-methods": "^7.26.0",
157+
"@babel/plugin-transform-private-property-in-object": "^7.26.0",
160158
"@babel/preset-env": "^7.28.3",
161159
"@babel/preset-react": "^7.27.1",
162160
"@babel/preset-typescript": "^7.27.1",
@@ -224,7 +222,7 @@
224222
"stylelint-scss": "^4.3.0",
225223
"tar": "^6.1.11",
226224
"ts-loader": "^9.3.1",
227-
"typescript": "^5.9.2",
225+
"typescript": "^5.9.3",
228226
"url-loader": "^4.1.1",
229227
"webpack": "^5.89.0",
230228
"webpack-bundle-analyzer": "^4.5.0",

webpack.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ module.exports = async (env, argv) => {
350350
filename: "assets/js/[name]-[chunkhash].js",
351351
publicPath: process.env.BASE_ASSETS_PATH || ""
352352
},
353-
target: ["web", "es2020"], // use es2020 for modern browsers as defined in browserslistrc
353+
target: ["web", "browserslist"], // defer to .browserslistrc for output targets
354354
devtool: argv.mode === "production" ? "source-map" : "inline-source-map",
355355
devServer: {
356356
client: {
@@ -477,8 +477,9 @@ module.exports = async (env, argv) => {
477477
}
478478
}
479479
},
480-
// On legacy browsers we want to show a "unsupported browser" page. That page needs to run on older browsers so w set the target to ie11.
481-
// Note: We do not actually include any polyfills so the code in these files just needs to be written with bare minimum browser APIs
480+
// Unsupported browser page: compile to IE11-compatible syntax for legacy browsers
481+
// TODO: Statically render the unsupported browser page, needs deeper thought given the localization maybe?
482+
// Note: We do not include polyfills here, so these files should only use minimal browser APIs
482483
{
483484
test: [
484485
path.resolve(__dirname, "src", "utils", "configs.js"),
@@ -487,7 +488,8 @@ module.exports = async (env, argv) => {
487488
],
488489
loader: "babel-loader",
489490
options: {
490-
presets: ["@babel/react", ["@babel/env", { targets: { ie: 11 } }]],
491+
// Target IE11 for this small set of files only
492+
presets: ["@babel/preset-react", ["@babel/preset-env", { targets: { ie: 11 }, loose: true }]],
491493
plugins: require("./babel.config").plugins
492494
}
493495
},

0 commit comments

Comments
 (0)