While working on my project, I encountered a "ReferenceError: _ is not defined" when using the .map function in this code snippet:
arr.map(async (elem) => {
...
});
I couldn't find any explicit mention of "_" in my code. The error trace pointed me to:
eval
webpack-internal:///./src/components/admin/NameOfMyFile.tsx (115:51)
step
node_modules/tslib/tslib.es6.js (102:0)
Object.eval [as next]
node_modules/tslib/tslib.es6.js (83:45)
asyncGeneratorStep
node_modules/@swc/helpers/src/_async_to_generator.mjs (3:0)
_next
node_modules/@swc/helpers/src/_async_to_generator.mjs (25:0)
eval
node_modules/@swc/helpers/src/_async_to_generator.mjs (32:0)
It appears that the issue lies in trying to use something from tslib.es6.js while my tsconfig.json specifies "target" as "es5". I'm unsure if this is relevant or just a distraction.
This error occurs on the client side in my Next.js project, while it's fine on the server side. Any insights or assistance would be greatly appreciated. Thank you!