The answer was to move the problematic plugins from devDependencies to dependencies via yarn remove
/yarn add
. I looked at the plugins from babel.config.js which produced errors, removed then from devDependencies and added them as normal dependencies as shown below.
[old package.json]
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/runtime": "7",
[...]
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
[...]
}
[new package.json]
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@babel/runtime": "7",
[...]
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
[...]
}
I also had to update babel.config.js with a preset-typescript plugin
presets: [ ...,
[
'@babel/preset-typescript',
{
useBuiltIns: true
}
]
]
I'd love to give you a brilliant explanation for why this works and what exactly caused this issue but I have no answers for that. I'd been using Typescript the entire time and deploying to my server without issue for several weeks.