Skip to content

Commit f7d5ffd

Browse files
committed
Fix exporting objects with non-configurable prototypes from RSCs
Fixes #10150
1 parent 8ce8d3f commit f7d5ffd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/core/integration-tests/test/react-server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,11 @@ describe('react server components', function () {
614614
it('should support inject CSS resources', async function () {
615615
await fsFixture(overlayFS, dir)`
616616
index.jsx:
617-
import {Server} from './Page.jsx';
617+
import {Server, foo} from './Page.jsx';
618618
function render() {
619619
return <Server />;
620620
}
621-
output = {render};
621+
output = {render, foo: foo.map(f => f * 2)};
622622
623623
Page.jsx:
624624
"use server-entry";
@@ -627,6 +627,8 @@ describe('react server components', function () {
627627
return <h1>Server</h1>;
628628
}
629629
630+
export const foo = [1, 2, 3];
631+
630632
server.css:
631633
.server { color: red }
632634
`;
@@ -656,6 +658,7 @@ describe('react server components', function () {
656658
);
657659

658660
let res = (await run(b, {output: null}, {require: false})).output;
661+
assert.deepEqual(res.foo, [2, 4, 6]);
659662
let output = res.render();
660663

661664
output.type.$$typeof;

packages/runtimes/rsc/rsc-helpers.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function createResourcesValueProxy(value, resources, bootstrapScript) {
4444

4545
let proxy = new Proxy(value, {
4646
get(target, prop, receiver) {
47-
if (prototypeProxy && prop === 'prototype') {
47+
if (prototypeProxy && prop === 'prototype' && Object.getOwnPropertyDescriptor(target, 'prototype').configurable) {
4848
return prototypeProxy;
4949
}
5050

0 commit comments

Comments
 (0)