-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .cjs config files #129
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 <[email protected]>
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
import
Performance impact
None
Security impact
None
Checklist
yarn lint:fix
passes.yarn test
passes.(not sure if that's something worth mentioning in README):
RELEASE_NOTES.md
file (if one exists).