next.js
c42c7cd0 - Fix emitting ESM swc helpers for 3rd parties CJS libs in bundle (#60169)

Commit
2 years ago
Fix emitting ESM swc helpers for 3rd parties CJS libs in bundle (#60169) Previously in #58967 we set all the module type as `'es6'` to let swc parse app router code as ESM and output as ESM due to the incorrect detection of CJS module by auto-cjs plugin, but this is not accurate when the external library bundle is CJS. The problem is when swc compiling modern syntax for example private properties in CJS bundle but emitted the swc helpers with ESM imports. We had a auto-cjs swc plugin to determine if the file is using CJS or not, @kdy1 fixed the bug of it so now we can use the default module type, and let the plugin to determine its module type, to make sure we're emitting the right helpers. Closes NEXT-1942 Based on #60118
Author
Parents
Loading