Is there a reason why the following does not work

Is there a reason why the following does not work

require() in Observable notebooks is d3-require, a loader for UMD/AMD modules. The require() you see in the svgpath readme is Node’s native require() for CommonJS modules.
Luckily you can import the package as ES module:
svgpath = (await import('https://esm.run/svgpath')).default