-
Notifications
You must be signed in to change notification settings - Fork 170
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
SyntaxError: Unexpected token 'export' #417
Comments
I'm having the same issue |
I'm experiencing similar issue. |
I'm having the same issue as well. |
I had the same issue when running from a quick and dirty docker image based on node-20, with migrate-mongo installed globally running the raw scripts, rather than from within a package. I worked around it by changing the migrate-mongo-config.js and migrations/* scripts to be non-esm. In migrate-mongo-config.js:
In scripts:
Hope that helps someone looking for a quick fix. |
Describe the bug
I am getting an error about using import in a project that uses ESM.
I see line 101 in migrationsDir is doing a require thats surrounded by a try catch. Doesn't seem like e.code === ERR_REQUIRE_ESM as its not running that and rethrowing the error.
Since it seems like the moduleSystem config variable was recently added, how about using that instead of a try catch to run the appropriate loader?
To Reproduce
I am using this via the programmable API.
Expected behavior
Should properly import when in esm environment.
Additional context
I am running this as a bin script. Package.json is set to type module and my config file for migrate-mongo has moduleSystem: 'esm'.
The text was updated successfully, but these errors were encountered: