I'm using Babel and Typescript in development, which I compile to JS for production. However, when trying to use microjob with an async function working locally I get a _functionName is not defined error.
Here is some simple code to reproduce:
//index.ts
import express from "express";
import {job, start} from "microjob";
const app = express();
app.get("/", async function(req: express.Request, res: express.Response) {
await start();
const test = async () => {
return 'test';
}
// all the below fail with the async before the function name above
// const result = await job(test);
// const result = await job(() => {
// return test();
// }, { ctx: { test }});
const result = await job(async () => {
return test();
}, { ctx: { test }});
// const result = await job(async () => {
// const response = await test();
// return response;
// }, { ctx: { test }});
res.send(result);
});
const port = 4790;
app.listen(port);
console.log(`view app at http://localhost:${port}`);
Hi,
I'm using Babel and Typescript in development, which I compile to JS for production. However, when trying to use microjob with an async function working locally I get a
_functionName is not defined
error. Here is some simple code to reproduce:My package.json:
.babelrc
My tsconfig.json
Node version 12.6.2
To note: Using an async function passed
Thanks for any help in advance :+1: