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.
This commit is contained in:
Andrew Clark
2022-02-22 20:03:51 -05:00
committed by GitHub
parent 4de99b3ca6
commit 552c067bb1
7 changed files with 15 additions and 15 deletions
@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react.shared-subset.production.min.js');
} else {
module.exports = require('./cjs/react.shared-subset.development.js');
}
@@ -1,7 +0,0 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-unstable-shared-subset.production.min.js');
} else {
module.exports = require('./cjs/react-unstable-shared-subset.development.js');
}
+3 -4
View File
@@ -16,19 +16,18 @@
"umd/",
"jsx-runtime.js",
"jsx-dev-runtime.js",
"unstable-shared-subset.js"
"react.shared-subset.js"
],
"main": "index.js",
"exports": {
".": {
"react-server": "./unstable-shared-subset.js",
"react-server": "./react.shared-subset.js",
"default": "./index.js"
},
"./package.json": "./package.json",
"./jsx-runtime": "./jsx-runtime.js",
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
"./unstable-shared-subset": "./unstable-shared-subset.js"
"./src/*": "./src/*"
},
"repository": {
"type": "git",
@@ -37,4 +37,4 @@ export {
useMutableSource as unstable_useMutableSource,
useTransition,
version,
} from './src/React';
} from './React';
+2 -1
View File
@@ -88,7 +88,8 @@ const bundles = [
{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: ISOMORPHIC,
entry: 'react/unstable-shared-subset',
entry: 'react/src/ReactSharedSubset.js',
name: 'react.shared-subset',
global: 'React',
minifyWithProdErrorCodes: true,
wrapWithModuleBoundaries: false,
+2 -2
View File
@@ -55,7 +55,7 @@ const forks = Object.freeze({
// happens. Other bundles just require('object-assign') anyway.
return null;
}
if (entry === 'react' || entry === 'react/unstable-shared-subset') {
if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
// Use the forked version that uses ES modules instead of CommonJS.
return './packages/shared/forks/object-assign.inline-umd.js';
}
@@ -82,7 +82,7 @@ const forks = Object.freeze({
entry,
dependencies
) => {
if (entry === 'react' || entry === 'react/unstable-shared-subset') {
if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
return './packages/react/src/ReactSharedInternals.js';
}
if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) {