allow to disable esm shim?
https://github.com/huozhi/bunchee/blob/c4fd6184f30f8c6202141a6c249651fbc5d06aa2/src/build-config.ts#L278
There are some reasons, for example, there is a TS file that is
const fetch = globalThis.fetch === 'undefined' ? require('node-fetch') : fetch
I won't have node:module because this package might be published to the browser. I just want to do some environment check here
If you disable the esm shim then the bundled code will be incorrect? How the require is supposed to be handled.
I feel like you should just do polyfill on server side chunks or exports if that can solve your case.
For example Im writing the polyfill code in a function it will both emit to cjs and esm. And in this case require function shouldn’t cause a side effect
It would cause other error if you don't shim require call, probably should consider dynamic import