next.js
588bb452 - Move `warnOnce` imports into statements guarded by `process.env.NODE_ENV === 'development'` (#94781)

Commit
29 days ago
Move `warnOnce` imports into statements guarded by `process.env.NODE_ENV === 'development'` (#94781) The context is this message from @icyJoseph: ``` I wonder if you've also look a little at DCE? This module, https://nextjs.org/_next/static/immutable/chunks/2uxebeysomvt2.js ships every time... ``` https://nextjs.org/_next/static/immutable/chunks/2uxebeysomvt2.js corresponds to this `warnOnce` helper: https://github.com/vercel/next.js/blob/643e34a59183f90ae9d2db9a64673781316ce786/packages/next/src/shared/lib/utils/warn-once.ts#L1 That doesn't do anything because Turbopack appears to be attempting to remove unused imports before doing dead-code removal. If the imports are moved though into the `(process.env.NODE_ENV !== 'production')` guard, this module won't get shipped into production. The patch to do this is pretty small so this PR does that, I'm going to look into whether its possible to reorder it so unused imports are looked at after dead code is removed.
Author
Parents
Loading