Sparticuz / chrome-aws-lambda

This package has been deprecated in favor of @sparticuz/chromium
https://www.github.com/sparticuz/chromium
MIT License
139 stars 21 forks source link

Add workaround to define __dirname when running via ESM #30

Closed landtechjoe closed 2 years ago

landtechjoe commented 2 years ago

When the file is imported via an ES Module rather than via commonjs the __dirname global variable does not exist. This is a quick polyfill to add it in when it is not present to try and get it working via ESM as well as commonjs

Currently can't test it works fully as running on an M1 mac so can't run the x86_64 chromium. If you can advise on how to test locally on ARM I'll be able to verify correctly