Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vite build failed on cloudflare pages

I'm trying to deploy my vite+react application on cloudflare pages, and it shows

(node:1365) ExperimentalWarning: The ESM module loader is experimental.
file:///opt/buildhome/repo/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^
SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:81:18)
    at async link (internal/modules/esm/module_job.js:37:21)
like image 703
Reset Power Avatar asked Jan 18 '26 18:01

Reset Power


1 Answers

Cloudflare pages uses an older version of node js which does not support this syntax.

you can change it by setting up the NODE_VERSION environnement variable in your build settings.

for more details about supported versions see : https://developers.cloudflare.com/pages/platform/build-configuration#language-support-and-tools

like image 119
Deer_Canidae Avatar answered Jan 21 '26 07:01

Deer_Canidae



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!