最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Vite build failed on cloudflare pages - Stack Overflow

programmeradmin2浏览0评论

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)

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)
Share Improve this question asked Aug 7, 2022 at 14:39 Reset PowerReset Power 332 silver badges3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

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./pages/platform/build-configuration#language-support-and-tools

发布评论

评论列表(0)

  1. 暂无评论