Incorrect import of main package
Opened this issue · 0 comments
niksy commented
There is a crucial difference in requiring main package inside .cjs file and using dynamic import
as mentioned in official documentation.
If you use require, Vite treats every export from that file as CommonJS and adds heuristic which implements their own mocking implementation which is wrong in terms what node-stdlib-browser
tries to achieve.
Using dynamic import
switches to ESM mode and uses ES modules implementatio which is a) correct in terms of mocking, b) allows tree-shaking and DCE.
Would you be willing to change that?