Skip to content

Build failure in rsc:use-client/build-references #826

@hi-ogawa

Description

@hi-ogawa

Regression from #794

When testing latest, I found many build failures in wakujs/waku#1655.

For example, react-tweet causes a following error:
https://stackblitz.com/edit/github-8f2jxtdr?file=src%2Froot.tsx

error during build:
[rsc:use-client/build-references] Could not load virtual:vite-rsc/client-references (imported by ../../dist/browser-QU10IP0-.js): Cannot read properties of undefined (reading 'replaceAll')
    at Object.load (file:///home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/dist/plugin-CNxA7P6H.js:1322:28)

meta.serverChunk is expected to exist and name to be a proper string, but apparently not.

let name =
useClientPluginOptions.clientChunks?.({
id: meta.importId,
normalizedId: manager.toRelativeId(meta.importId),
serverChunk: meta.serverChunk!,
}) ?? meta.serverChunk!
// ensure clean virtual id to avoid interfering with other plugins
name = cleanUrl(name.replaceAll('..', '__'))

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions