jobs/index.js as an ESM module
maxpain opened this issue · comments
Max Makarov commented
Hello. Bree should use import
instead of require
for jobs/index.js
as an ESM module.
jobs/index.js:
const jobs = ['job'];
export default jobs;
Error:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/maxpain/dev/fastcup/backend/cron/.build/jobs/index.js from /Users/maxpain/dev/fastcup/backend/cron/node_modules/bree/src/index.js not supported.
Instead change the require of /Users/maxpain/dev/fastcup/backend/cron/.build/jobs/index.js in /Users/maxpain/dev/fastcup/backend/cron/node_modules/bree/src/index.js to a dynamic import() which is available in all CommonJS modules.
at Bree.init (/Users/maxpain/dev/fastcup/backend/cron/node_modules/bree/src/index.js:207:28)
at new Bree (/Users/maxpain/dev/fastcup/backend/cron/node_modules/bree/src/index.js:172:10)
at file:///Users/maxpain/dev/fastcup/backend/cron/.build/index.js:17:14
at async Promise.all (index 0) {
code: 'ERR_REQUIRE_ESM'
}
titanism commented
v9.0.0 released to npm and GitHub
NOTE: There are breaking changes! Please read https://github.com/breejs/bree/blob/master/UPGRADING.md#upgrading-from-v8-to-v9 for more insight how to upgrade from v8 to v9.
Max Makarov commented
Thanks!