timothymiller / t4-app

A powerful cross-platform UI toolkit for building actually native iOS, Android, macOS, Windows, Linux, and Progressive Web Apps with React (Native).
https://t4stack.com
MIT License
1.45k stars 77 forks source link

Problems with tamagui styles on Cloudflare pages #36

Closed darthwade closed 1 year ago

darthwade commented 1 year ago

Hi @timothymiller

Thank you so much for your work on T4. Amazing stack! I have a question, after deployment to Cloudflare pages based on your docs, I see next: https://zeus-3v5.pages.dev

Could you pls help me in what direction should I dig? Thanks once more

darthwade commented 1 year ago

Btw, during deployment I also encountered "Error: Could not access built-in Node.js modules. Please make sure that your Cloudflare Pages project has the 'nodejs_compat' compatibility flag set."

adding node_compat to wrangler.toml didn't help, but applying node_compat via CF dashboard helped

[env.preview]
name = "zeus-web-preview"
workers_dev = true
node_compat = true
compatibility_flags = [ "nodejs_compat" ]

[env.production]
name = "zeus-web"
route = "zeus-3v5.pages.dev/*"
workers_dev = false
node_compat = true
compatibility_flags = [ "nodejs_compat" ]
timothymiller commented 1 year ago

Yep you have to set node_compat via the CF dashboard. I'm open to solutions that make that process programatic.

Do you have optimizeCSS set in next.config.js? Turn it off if you do.

darthwade commented 1 year ago
image

disabled

timothymiller commented 1 year ago

That's strange. Ensure your fork is up to date with the main branch and re-deploy.

darthwade commented 1 year ago

will do, I created it yesterday via pnpm create t4-app, locally looks good

darthwade commented 1 year ago

Updated to latest version from main branch, so probably there's some problem during building or deployment/cf configuration https://zeus-3v5.pages.dev

timothymiller commented 1 year ago

Make sure your CF deployment is set to node 18!

darthwade commented 1 year ago

Strange, recreated cf project from scratch with NODE_VERSION 18 env var, but still same problem https://zeus-web.pages.dev

image
darthwade commented 1 year ago

After adding TAMAGUI_TARGET=web it finally works :) @timothymiller thanks for help!

"dev": "TAMAGUI_TARGET=web pnpm with-env next dev",
"build": "TAMAGUI_TARGET=web pnpm with-env next build",
"start": "TAMAGUI_TARGET=web pnpm with-env next start",
timothymiller commented 1 year ago

@darthwade This was originally set, it must have been removed by a recent PR.

I added it back so other people don't experience this. Thanks for debugging!