feat(esm): add support for .gmrc as an ES Module
Followup of https://github.com/graphile/migrate/pull/129#issuecomment-880013996
You know what... Let's just drop Node 10 support. Node 12 should handle this natively and 10 is no longer LTS anyway.
@guillaumervls Please could you test to see if this works in your setup? I anticipate it will.
@benjie Yes it works! (also I've fixed the prettier fail)
@benjie Any chance this pr will ever get merged in? It's almost been a year and node 12 has reached eol let alone Node 10.
Just tested this on Node 16 and it breaks commonJS compatibility :disappointed:
It turns out this doesn't use the native import due to TypeScript configuration.
@andrew-w-ross Feel free to raise a PR against this branch to fix the remaining issues.
@benjie I gave it a go this evening and to actually fix it I'd have to change typescript module mode to Node16 or NodeNext to get typescript to emit dynamic imports. That seemed like a step too far so instead I went for a safer route that allows .cjs extension on config files #161. It at least gives a workaround for es module packages.
@benjie Have you had a chance to look at that pr I opened?
(The above mentioned PR was https://github.com/graphile/migrate/pull/161 for anyone looking.)
graphile-config is Graphile's new configuration format to be shared across all the Graphile projects, and it supports ESM, CJS, TypeScript and more. We will probably move away from a .gmrc file to a graphile.config.ts (or similar) file for Graphile Migrate, which will address this issue.