The inherently dynamic require() was changed to a static import in the conversion to ES modules¹ with "Use cjs-to-es6 to help conversion" (1963fcd). That broke the intended delayed import, since Node.js starts locating and executing static imports before the actual import statements are reached in the importing module's execution. Use a dynamic import() instead to restore the delayed import.
We delay the import until after setting global.verbose so that calls to utils.verbose() in the codebase respect the server's --verbose option as expected.
The missing utils.verbose() output this caused was first noticed by @jameshadfield.²
The inherently dynamic require() was changed to a static import in the conversion to ES modules¹ with "Use cjs-to-es6 to help conversion" (1963fcd). That broke the intended delayed import, since Node.js starts locating and executing static imports before the actual import statements are reached in the importing module's execution. Use a dynamic import() instead to restore the delayed import.
We delay the import until after setting global.verbose so that calls to utils.verbose() in the codebase respect the server's --verbose option as expected.
The missing utils.verbose() output this caused was first noticed by @jameshadfield.²
¹ https://github.com/nextstrain/nextstrain.org/pull/583
² In https://github.com/nextstrain/nextstrain.org/pull/678 as 191ffa28d04424de593fe02132f5f86bbb5cfcbb, a different proposed fix.
Testing