-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set node: true
on cloudflare-pages preset
#1315
Conversation
Iβm talking about the Cloudflare Pages build environment, which is different than what you linked to. https://developers.cloudflare.com/pages/platform/language-support-and-tools/ It looks like your link was to Cloudflare Workers info, which isnβt the same thing. Itβs quite possible that this PR is for the wrong preset, but the issue this is for is related to the CFP build environment which is full Node. Am I misunderstanding this preset? |
Both workers and pages are built on the same technology, workerd, which is a Javascript runtime that is different from node.js. Cloudflare Pages CI (ie the thing that hooks to a github repo and automatically rebuilds your website) uses Node for your builds, but not the runtime. |
Maybe you can point me in the right direction if this isn't it, or if this isn't the correct preset configuration option, but the CFB build environment is what I'm talking about, and it runs actual Node. The issue is that currently when running in the Cloudflare Pages build environment, either v1 or the v2 beta (as described here) and deploying a static site, Nitro incorrectly things that Node isn't available. The build environment and build process give messages like
It runs the Is the issue here that this preset configuration is not for the CFP build environment, but is for the runtime environment, and this PR is just for the wrong file? Again, the environment I'm trying to address here is definitely running Node and only during a single-run build step, not any sort of deployed runtime environment, and Nitro is guessing the node status incorrectly (see this issue for Nuxt/Image and IPX as an example.) |
My apologies, now that I see the Image issue I see your problem. Looking into it, this node: true flag is for the rollup configuration, and it looks like it does affect the final bundle. So I'm not sure this is a sane default for all builds... Given that Nitro can only be built with Node, this issue shouldn't happen in the first place though. |
As a test of this, running
Nitro definitely seems to be detecting (or assuming?) this incorrectly, and reading |
Ah, so is your thought here that this just isn't the right fix for this issue, and the problem needs to be addressed elsewhere? |
Yes, this could cause a bunch of others issues as doing this disable a lot of the unenv mocks. However I'm very often getting issues with this part of the code anyways, see here nuxt/nuxt#21619 |
Hi. Thanks for the PR. Following up conversation, @Hebilicious is correct. Nuxt nitro always uses Node.js for building phase. The A related matter, cloudflare workers, has some native polyfills for some node.js imports which we need to enable once the compatibility flag is enabled by users (which is not by default). #1171 |
π Linked issue
#1314
β Type of change
π Description
Cloudflare pages supports node by default, but the
cloudflare-pages.ts
preset has this option set tofalse
as it is inherited from the base preset. This PR adds an explicitnode: true
to the cloudflare-pages preset.π Checklist