top | item 37149992

(no title)

c_s_guy | 2 years ago

I was actually looking into building a library today with Webpack and ran into similar problems. But could you help me understand what you meant here?

> but it won't output to a standard format, even with experimental ESM output feature enabled,

Are you saying ESM is not a standard format? Or that the ESM output doesn't actually follow standard ESM? Or maybe you meant something else entirely?

discuss

order

crooked-v|2 years ago

Trying to make ESM actually work in the JS ecosystem is still wildly experimental and incredibly painful. https://blog.isquaredsoftware.com/2023/08/esm-modernization-...

WorldMaker|2 years ago

It's bad for them because their support matrix still includes versions of Node and webpack that haven't been in even LTS support for years at this point.

It's great that they want to support such a long tail. I know that makes a lot of developers very happy that they can rely on that.

In my experience ESM is not painful at all if you can rip the bandaid off and drop Webpack 4 (and below) and any version of Node less recent than current LTS. That's a lot easier done in greenfield projects than those that have long tail support matrices to contend. Brownfield projects should get better as more and more of that tail dies off.

no_wizard|2 years ago

opposite issue, webpack doesn't output plain ESM code for libraries (IE, no __webpack__require__ etc.). Its both experimental and sometimes completely incorrectly generated, while still generating library code with webpack specific references.