Conversation
Hello, This is a quick* fix the use of JS config files in projects where `"type": "module"` is used in `package.json` (which will me more and more frequent now that Node 10 obsolete). Cheers! *The right way might be to support it via `import`
|
Could you complete this with a |
|
I've added it, but I don't know how to do the correct switch between require and import. For now I've put a test on the file extension, but in the case of |
We could scan for this I suppose. It feels a bit expensive though since we might have to walk up a directory tree looking for a package.json which might not exist (e.g. if you're using migrate standalone). I think just requiring |
Co-authored-by: Benjie Gillam <benjie@jemjie.com>
|
Yes. I actually thought there could have been another solution than scanning the file system, some kind of global variable that Node sets when it's in "module" mode, that I wasn't aware of. |
I tried looking for this, but I've not managed to find it either. I have found an interesting behaviour though - in a commonJS file if Now run |
|
Wait... Are we overthinking it?
(As you may guess, I'm not keen to merge this until I'm certain the direction we're taking is correct.) |
Description
Hello,
This is a quick* fix the use of JS config files in projects where
"type": "module"is used inpackage.json(which will me more and more frequent now that Node 10 obsolete).Cheers!
*The right way might be to support it via
importPerformance impact
None
Security impact
None
Checklist
yarn lint:fixpasses.yarn testpasses.(not sure if that's something worth mentioning in README):
RELEASE_NOTES.mdfile (if one exists).