| ▲ | esperent 13 hours ago | ||||||||||||||||||||||
> lodash-es doesn’t ESM lodash/fp Most of my career has been JS and TS and I have no idea what this means. | |||||||||||||||||||||||
| ▲ | soulofmischief 12 hours ago | parent | next [-] | ||||||||||||||||||||||
I'm guessing you're only a few years into your web career, so I'll provide some background. lodash is a popular library that fills in many blanks that pre-2015 JavaScript had. It still provides value in modern JavaScript, but it's no longer as important as it used to be. JavaScript is actually based on a standard called ECMAScript. ActionScript shares this standard, as an example. In 2015, we got ECMAScript 5, which modernized JavaScript in many ways. With that came many changes such as ECMAScript moving to a yearly update cadence, in response to the large amount of effort involved in implementing ES5, which came with a ton of changes. One of those changes was ES modules, or ESM, which provided an official way for working with modules. The import/export syntax you're used to is a part of that spec. Before this, we had competing non-standard specifications for module loading, such as CommonJS. ES5 reduced the need for tools such as lodash, and so it's less common in newer projects. It also is old enough to have been around before ESM was adopted, and is a large project, and so like many projects it either had to completely rewrite everything, or use transformation tools such as babel. If not, the user was responsible for using babel/etc to transform the code. Now, in modern stacks, because this is unnecessary, native support for CommonJS is being phased out, leading to OP's conundrum. Now we have TypeScript, and the horrors of JavaScript 10+ years ago are a fading memory. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | nailer 12 hours ago | parent | prev [-] | ||||||||||||||||||||||
It’s not just you, nobody uses ESM as a verb, I think they mean: The package doesn’t export lodash/fp in the ESM version. | |||||||||||||||||||||||
| |||||||||||||||||||||||