Urgent.News

What's breaking now, across thousands of outlets.

Tech

One version bump, 40 files to edit. Import maps fix that.

grep -rl "esm.sh/lodash-es@4.17.21" src/ came back with forty-one files. Forty-one places where the same CDN URL, pinned to the same version, was typed out by hand at the top of a module. The security advisory said bump to 4.17.22. A sed one-liner across the repo felt fine until it silently skipped the two files that imported a named subpath with a slightly different query string. That's the…

The source material discusses a single change to an import map in a project that required updating 40 files to use the new version of the Lodash library. The import map is a JSON block that allows browsers to resolve module specifiers to specific URLs, eliminating the need to manually copy the CDN URL in each import statement. The key is that the version number is now stored in one place, making it easier to update.

The article also explains that browsers can resolve bare specifiers to URLs through import maps, which provides a more consistent experience across different environments like browsers and Node.js.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Sunday 23 August →