Skip to content

Commit

Permalink
Remove deprecated wildcard folder mapping
Browse files Browse the repository at this point in the history
Node v16 deprecated the use of trailing "/" to define subpath folder
mappings in the "exports" field of package.json.

We could switch this to "/*" instead. However, the recommendation is to
explicitly list the public paths you want to export.

So instead, we can remove the wildcard export. The only reason we added
it in the first place was because of an implementation detail of the
custom Rollup plugin that we use to resolve forked internal modules at
build time. The plugin relied on require.resolve, which doesn't work
with ESM modules. I fixed this by removing the require.resolve call
in facebook#23255.

The only two affected packages are react-dom and react. We need to be
sure that all our public modules are still reachable. I audited the
exports by comparing the entries to the "files" field in package.json,
which represents a complete list of the files that are included in the
final release artifact.

At some point, we should add an e2e packaging test to prevent
regressions; for now, we should have decent coverage because in CI we
run our Jest test suite against the release artifacts.
  • Loading branch information
acdlite committed Feb 9, 2022
1 parent d283f4a commit e6ccec8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
},
"./profiling": "./profiling.js",
"./test-utils": "./test-utils.js",
"./package.json": "./package.json",
"./": "./"
"./unstable_testing": "./unstable_testing.js",
"./umd/*": "./umd/*",
"./package.json": "./package.json"
},
"browser": {
"./server.js": "./server.browser.js"
Expand Down
4 changes: 3 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"./package.json": "./package.json",
"./jsx-runtime": "./jsx-runtime.js",
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
"./": "./"
"./umd/*": "./umd/*",
"./unstable-shared-subset": "./unstable-shared-subset.js"

},
"repository": {
"type": "git",
Expand Down

0 comments on commit e6ccec8

Please sign in to comment.