Open gilliardmacedo opened 2 years ago
Hey @gilliardmacedo, it seems like it's yarn rw build
that's failing and not prerender specifically right? I understand that prerender needs build, but just want to make sure.
Looking at the error, it has to do with core-js. Is there any way you could provide a reproduction? Or narrow it down to what page isn't building, then provide the code for that? Does your project have any custom babel config?
I've seen this reported once before and the reason always seems to be different depending on the project, but we've solved it so if I could get more information I'm sure we could figure it out.
Thanks @gilliardmacedo for reaching out ;)
@jtoar I'm in @gilliardmacedo 's team actually, he'll correct me but I think we only had NotFoundPage with prerendering. Also here's some babel:
module.exports = {
plugins: ['@emotion'],
}
Pretty thin! We are using chakra, but I don't know if it was setup with RW or before the command was shipped. Could be some conflicts somewhere. Gilliard has the lead on this, I'm merely backing up.
Hey @jtoar
I have the same issue on a 3.2.0
Here's the error code:
---------- Error rendering path "/404" ----------
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/abr/Documents/perso/Projects/zef/node_modules/@simplewebauthn/browser/dist/bundle/index.js from /home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/auth/dist/webAuthn/index.js not supported.
Instead change the require of /home/abr/Documents/perso/Projects/zef/node_modules/@simplewebauthn/browser/dist/bundle/index.js in /home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/auth/dist/webAuthn/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.newLoader [as .js] (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:141:7)
at Object.<anonymous> (/home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/auth/dist/webAuthn/index.js:15:16)
at Module._compile (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:136:24)
at Object.newLoader [as .js] (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:141:7)
at Object.<anonymous> (/home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/auth/webAuthn/index.js:2:18)
at Module._compile (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:136:24)
at Object.newLoader [as .js] (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:141:7)
at Object.<anonymous> (/home/abr/Documents/perso/Projects/zef/web/src/App.tsx:24:40)
at Module._compile (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:136:24)
at Object.newLoader [as .tsx] (/home/abr/Documents/perso/Projects/zef/node_modules/pirates/lib/index.js:141:7)
at /home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/prerender/dist/runPrerender.js:179:123
at async runPrerender (/home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/prerender/dist/runPrerender.js:179:7)
at async Task.task (/home/abr/Documents/perso/Projects/zef/node_modules/@redwoodjs/cli/dist/commands/prerenderHandler.js:195:35)
Some more information: I'm using Chakra UI and I've set up the db-auth.
Keep up the good work RedwoodJS is a very exciting project, I'm building with it for the first time. I had a couple of issues, regarding auth and this one, but overall it's great. Thank you so much for your work!
Getting the same error, can't prerender any pages atm. I'm using rw 3.5.0, Chakra UI, and have dbAuth set-up.
---------- Error rendering path "/account" ---------- Error [ERR_REQUIRE_ESM]: require() of ES Module [...]/node_modules/@redwoodjs/auth/dist/webAuthn/index.js not supported.`
{ "data": { "redwood": { "version": "3.5.0", "currentUser": null, "prismaVersion": "4.5.0" } } }
Hello guys (@jtoar), kind of same error here, first was"TypeError: $ is not a function" in core-js, so I added
"resolutions": { "react": "17.0.2", "react-dom": "17.0.2", "core-js": "3.26.0" },
to the root package.json
after that If I run yarn rw prerender
or yarn rw prerender --dry-run
, did passed, but when built it fails, "no error showing",
i decided to Update libraries yarn update yarn upgrade --latest
delete yarn.lock, node_modules in api, web and root.
and re install using yarn install --force
,
after digging around this subject, i found out this line could be the error:
just changing it to
cwd: rwjsPaths.base
makes it work,
so i think just running the yarn rw prerender from the base folder can fix the issue
still no es module support with prerender :/ prerender does not use vite right?
@dennemark As of RW v5 prerender works with vite. ESM support is still ongoing work.
What's not working?
We created our project 8 months ago and maintain the generated NotFound route untouched so far. This is our single prerendered route. Recently we did the upgrade to Redwood 3 and I saw firstly this error.
After read the issue, I changed react and react-dom version from:
to:
and removed node_modules and yarn.lock.
Then I tried again:
Result:
I used the dry run just like the log suggests, but it succeeds:
For now I removed prerender directive from the route.
How do we reproduce the bug?
No response
What's your environment? (If it applies)
Are you interested in working on this?