2 ms·
agree. i ought to be a javascript expert by now but nothing makes me feel dumber than navigating all the type:module and .js/cjs/mjs/ts stuff. for a production
by swyx 3y ago
agree. i ought to be a javascript expert by now but nothing makes me feel dumber than navigating all the type:module and .js/cjs/mjs/ts stuff. for a production app of course you should be clear about what you are writing. but for prototyping Bun's permissiveness lets me write code first and worry about the rest later.
- pests 3y agoI've been writing JavaScript for a long... long... time and I've kinda zoned out the last few years with regards to ESM vs CSJ I only know that I perfer writing import over require as those semantics and syntax make more sense to me.
- afgrant 3y agoFor the benefit of the future reader, I’m guessing you meant “CJS”, short for CommonJS.
- arjvik 3y ago> for a production app of course you should be clear about what you are writing Agree in sentiment, but I don't think this even applies to the module/import mess. My experience has been that the difficulty is in using different packages that made different choices, and making them interop with your own code. I have still yet to make top-level await work in a Typescript codebase where I need to import nontrivial packages. I don't think you should ever need to worry about the specific way your modules are imported, not in prototyping or in production.