a035224dc3
For RSC server layer so far we bundle all dependencies, ESM format is the better one rather than CJS to analyze and tree-shake out the unused parts. This PR changes pick the condition names that are in ESM format first for server layer. Also fixes the misorder of condition names of edge runtime, `conditionNames` should only contain either ESM or CJS, previously the main fields are mixed with conditon names which is not expected for webpack, we separate them now. Since we're picking ESM instead CJS now, the error of require `exports * from` doesn't exist anymore, but if you're using a CJS dependency which require a ESM package, it will error. This is the existing behavior for our webpack configuration but could happen on server layer bundling Other related changes: * Imports are hoisted in ESM, so migrate`enhanceGlobals` to a imported module * Use `...` to pick the proper imports by import expression, and prefer the `react-server` / `edge-light` condition names for corresponding cases * Remove edge SSR duplicated `middleware` export checking |
||
---|---|---|
.. | ||
client-dep | ||
css | ||
esm | ||
esm-client-ref | ||
external-imports | ||
font | ||
react-server | ||
shared-esm-dep | ||
wildcard | ||
layout.js |