简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM