next.js
6635cc07 - Apply react-server conditions to middleware (#65424)

Commit
1 year ago
Apply react-server conditions to middleware (#65424) ### What Reland #57448 , add react-server condition resolving and apply server-only rules to middleware Closes NEXT-1653 Closes NEXT-3333 ### Why Middleware as the pre-routing layer that is indended to be light-weight. Since it's on edge runtime and only run on server but not on client, it doesn't need to include the client react bundles. Hence we apply `react-server` export condition, that if users import React we can only bundle server required APIs and if users use React client hooks we can error.
Author
Parents
Loading