After utilizing Nuxt 2.1 in my app, I proceeded to upgrade it gradually and everything was fine until Nuxt 2.4. However, starting from version 2.5 and above, production builds are breaking with an error stating global is not defined
.
The location of the error lies within .nuxt/client.js@26
:
if (!global.fetch) { global.fetch = fetch }
I am struggling to find the solution for this issue (seems like defining global
is necessary), and I have not been able to come across any helpful answers so far.
List of dependencies:
"dependencies": {
...
},
"devDependencies": {
...
}
.babelrc:
{
"presets": ["@babel/env"],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-export-namespace-from"
]
}