Hi friends! Having a small issue that I can't seem...
# help
a
Hi friends! Having a small issue that I can't seem to figure out. I'm working on a social image generator much like the tutorial has, but my app is using esm bundles to get top level awaits etc. The problem is that
chrome-aws-lambda
uses
__dirname
in it's code, which doesn't work when in esm. Not sure if there's an easy way around this, or if I should just have the one function not use ESM or something, either way any help would be greatly appreciated! 🙂
d
Replacement: `
Copy code
import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
a
Tried that too and it still wouldn't work. But this is a background task so just threw it in a queue and made the function a cjs bundle. ¯\_(ツ)_/¯