Hacker News new | past | comments | ask | show | jobs | submit login

One problem I encountered with ESM TypeScript development on the browser without bundling: many Node packages aren't set up for that.

You might ask why without bundling?

Sometimes you just want to start something simple on the browser and compile to JavaScript on the fly.

I tried the dev server from Modern Web [0], and I liked it. I program in TypeScript and the browser reloads whenever I save a file. Of course I could set up a bundler and for a small program waiting times are negligible. But I hate bundlers. I know it's irrational, but nowadays I program for fun so I think I should have the choice to reject bundlers.

This fails for many Node dependencies. There is a conflict between CommonJS and ESM. I am not 100% sure that what I want to achieve is impossible without forking dependencies and making a small change.

I even found a way to have a CommonJs and ESM polyglot, but this hack is extremely ugly. I named the hack modglot [1]. I don't think this is a good idea and I don't understand enough to propose something. I am somewhat dejected about the current state of TypeScript development for the browser and paused development.

Now I am programming in Rust again just for fun, but if I return to TypeScript, probably I will try out Deno.

[0]: https://modern-web.dev/guides/dev-server/getting-started/

[1]: https://github.com/nalply/modglot




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: