Skip to content

Commit 552c067

Browse files
authored
Remove public export for unstable-shared-subset.js (#23261)
The unstable-shared-subset.js file is not a public module — it's a private module that the "react" package maps to when it's accessed from the "react-server" package. We originally added it because it was required to make our Rollup configuration work, because at the time only "public" modules could act as the entry point for a build artifact — that's why it's prefixed with "unstable". We've since updated our Rollup config to support private entry points, so we can remove the extra indirection.
1 parent 4de99b3 commit 552c067

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./cjs/react.shared-subset.production.min.js');
5+
} else {
6+
module.exports = require('./cjs/react.shared-subset.development.js');
7+
}

packages/react/npm/unstable-shared-subset.js

-7
This file was deleted.

packages/react/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@
1616
"umd/",
1717
"jsx-runtime.js",
1818
"jsx-dev-runtime.js",
19-
"unstable-shared-subset.js"
19+
"react.shared-subset.js"
2020
],
2121
"main": "index.js",
2222
"exports": {
2323
".": {
24-
"react-server": "./unstable-shared-subset.js",
24+
"react-server": "./react.shared-subset.js",
2525
"default": "./index.js"
2626
},
2727
"./package.json": "./package.json",
2828
"./jsx-runtime": "./jsx-runtime.js",
2929
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
30-
"./unstable-shared-subset": "./unstable-shared-subset.js"
31-
30+
"./src/*": "./src/*"
3231
},
3332
"repository": {
3433
"type": "git",

packages/react/unstable-shared-subset.experimental.js renamed to packages/react/src/ReactSharedSubset.experimental.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ export {
3737
useMutableSource as unstable_useMutableSource,
3838
useTransition,
3939
version,
40-
} from './src/React';
40+
} from './React';

scripts/rollup/bundles.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ const bundles = [
8888
{
8989
bundleTypes: [NODE_DEV, NODE_PROD],
9090
moduleType: ISOMORPHIC,
91-
entry: 'react/unstable-shared-subset',
91+
entry: 'react/src/ReactSharedSubset.js',
92+
name: 'react.shared-subset',
9293
global: 'React',
9394
minifyWithProdErrorCodes: true,
9495
wrapWithModuleBoundaries: false,

scripts/rollup/forks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const forks = Object.freeze({
5555
// happens. Other bundles just require('object-assign') anyway.
5656
return null;
5757
}
58-
if (entry === 'react' || entry === 'react/unstable-shared-subset') {
58+
if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
5959
// Use the forked version that uses ES modules instead of CommonJS.
6060
return './packages/shared/forks/object-assign.inline-umd.js';
6161
}
@@ -82,7 +82,7 @@ const forks = Object.freeze({
8282
entry,
8383
dependencies
8484
) => {
85-
if (entry === 'react' || entry === 'react/unstable-shared-subset') {
85+
if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
8686
return './packages/react/src/ReactSharedInternals.js';
8787
}
8888
if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) {

0 commit comments

Comments
 (0)