Home > Software design >  Vite build failed on cloudflare pages
Vite build failed on cloudflare pages

Time:08-08

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)

CodePudding user response:

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

  • Related