Skip to content

I can't prerender when using cloudflare or cloudflare-d1 templates #12758

Closed
@gmtborges

Description

@gmtborges

As mentioned here to include NODE_ENV=production in the build script #12508 (comment) it fixed in the default template, but using cloudflare or d1 it still fails.

The error

x Build failed in 307ms
[react-router] Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at groupRoutesByParentId2 (/Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/@react-router+dev@7.0.2_@react-router+serve@7.0.2_react-router@7.0.2_react-dom@19.0.0_react@1_3qikndsdtuyn7j5gt5pgxdglyi/node_modules/@react-router/dev/dist/vite.js:2650:10)
    at createPrerenderRoutes (/Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/@react-router+dev@7.0.2_@react-router+serve@7.0.2_react-router@7.0.2_react-dom@19.0.0_react@1_3qikndsdtuyn7j5gt5pgxdglyi/node_modules/@react-router/dev/dist/vite.js:2661:76)
    at handlePrerender (/Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/@react-router+dev@7.0.2_@react-router+serve@7.0.2_react-router@7.0.2_react-dom@19.0.0_react@1_3qikndsdtuyn7j5gt5pgxdglyi/node_modules/@react-router/dev/dist/vite.js:2477:16)
    at Object.handler (/Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/@react-router+dev@7.0.2_@react-router+serve@7.0.2_react-router@7.0.2_react-dom@19.0.0_react@1_3qikndsdtuyn7j5gt5pgxdglyi/node_modules/@react-router/dev/dist/vite.js:2029:13)
    at async Promise.all (index 0)
    at PluginDriver.hookParallel (file:///Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/rollup@4.28.1/node_modules/rollup/dist/es/shared/node-entry.js:20740:9)
    at file:///Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/rollup@4.28.1/node_modules/rollup/dist/es/shared/node-entry.js:21783:13
    at catchUnfinishedHookActions (file:///Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/rollup@4.28.1/node_modules/rollup/dist/es/shared/node-entry.js:21158:16)
    at Module.build (file:///Users/gustavo/repos/estudos/js/cf-rr/node_modules/.pnpm/vite@5.4.11_@types+node@20.17.9/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:65449:16) {
  code: 'PLUGIN_ERROR',
  plugin: 'react-router',
  hook: 'writeBundle'
}
 ELIFECYCLE  Command failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions