Hi, I used npm create cloudflare@latest to setup a basic js Worker project.
Upon swapping the hello world template's index.js, when running the project I ran into the following issue:
Error [ERR_REQUIRE_ESM]: require() of ES Module [...]\node_modules\youch\build\index.js from [...]\node_modules\miniflare\dist\src\index.js not supported.
Instead change the require of [...]\node_modules\youch\build\index.js in [...]\node_modules\miniflare\dist\src\index.js to a dynamic import() which is available in all CommonJS modules.
at handlePrettyErrorRequest ([...]\node_modules\miniflare\dist\src\index.js:70941:21)
at async #handleLoopback ([...]\node_modules\miniflare\dist\src\index.js:81676:20)
the file, with only the following (original script has more but just this is enough to cause the issue):
export default {
async fetch(req) {
const repo = "example/Repository"
const releases = await fetch(
`https://api.github.com/repos/${repo}/releases`
).then(r => r.json())
return new Response('Hello World!');
}
}
causes this. I changed nothing in any other file than index.js. Nothing online about people having the issue for specifically youch and miniflare. There is one post on this discord about it, but no one answered it. https://discord.com/channels/595317990191398933/1415375932616872028