You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am getting an error about using import in a project that uses ESM.
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.require (/workspaces/mrp/node_modules/migrate-mongo/lib/utils/module-loader.js:3:12)
at Object.loadMigration (/workspaces/mrp/node_modules/migrate-mongo/lib/env/migrationsDir.js:101:27) {
migrated: []
}
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.
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: