const netlify_1 = __importDefault(require("netlify"));
Error [ERR_REQUIRE_ESM]: require() of ES Module /my-app/node_modules/netlify/src/index.js from /my-app/dist/graphql/resolvers/Mutations/site.js not supported.
Instead change the require of index.js in /my-app/dist/graphql/resolvers/Mutations/site.js to a dynamic import() which is available in all CommonJS modules.
I filed an issue on the GitHub repo for netlify js client and they said it’s expected. The client api only exports esm not common js. The proposed solution is to use “module: ‘nodenext’”, but doing that breaks a bunch of other imports and it also isn’t a stable release yet. Alternatively it was suggested to use a dynamic import, but I got the same error when doing that.
So I gave up and wrote my own.
Not sure why the js client wouldn’t be compatible in ts environments, but it appears to not be.