migrate icon indicating copy to clipboard operation
migrate copied to clipboard

feat(esm): add support for .gmrc as an ES Module

Open guillaumervls opened this issue 4 years ago • 10 comments

Followup of https://github.com/graphile/migrate/pull/129#issuecomment-880013996

guillaumervls avatar Sep 15 '21 13:09 guillaumervls

You know what... Let's just drop Node 10 support. Node 12 should handle this natively and 10 is no longer LTS anyway.

benjie avatar Sep 23 '21 11:09 benjie

@guillaumervls Please could you test to see if this works in your setup? I anticipate it will.

benjie avatar Sep 23 '21 11:09 benjie

@benjie Yes it works! (also I've fixed the prettier fail)

guillaumervls avatar Sep 23 '21 16:09 guillaumervls

@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.

andrew-w-ross avatar Jul 14 '22 00:07 andrew-w-ross

Just tested this on Node 16 and it breaks commonJS compatibility :disappointed:

benjie avatar Jul 14 '22 09:07 benjie

It turns out this doesn't use the native import due to TypeScript configuration.

benjie avatar Jul 14 '22 09:07 benjie

@andrew-w-ross Feel free to raise a PR against this branch to fix the remaining issues.

benjie avatar Jul 14 '22 10:07 benjie

@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.

andrew-w-ross avatar Jul 15 '22 01:07 andrew-w-ross

@benjie Have you had a chance to look at that pr I opened?

andrew-w-ross avatar Jul 26 '22 22:07 andrew-w-ross

(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.

benjie avatar Nov 08 '23 09:11 benjie