next.js
29276c19 - Turbopack: properly replace `__dirname` and `__filename` (#78843)

Commit
304 days ago
Turbopack: properly replace `__dirname` and `__filename` (#78843) Replace `__dirname` and `__filename` references at compile time Our current approach of computing `__dirname` at runtime based on the module id is broken in production builds where numeric ids are used. Arguably it is incorrect in development builds as well as the value we produce is not actually usable as a path. We already compute a correct __dirname and __filename for our statically evaluated functions, so this uses the same approach which is to use the source path of the module. Closes PACK-4332
Author
Parents
Loading