elrumordelaluz / path-that-svg

Path that SVG!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: svgToPath is not a function

ashishepost opened this issue · comments

When I am tring to execute example code get this error

Hi @ashishepost, thanks for open the Issue.

Could you please share a little more information?

Here is the working example. Feel free to tweak that sandbox to show where is the error you are getting.

@elrumordelaluz (node:19393) UnhandledPromiseRejectionWarning: TypeError: svgToPath is not a function when I try to require the package in my node environment.

Node version: v12.16.1

I temporary fixed this by changing the last line in dist\pathThatSvg.cjs.js

from

exports.default = indexEs;

to

module.exports = indexEs;

Hope the info helps.

You could import the package as

const svgToPath = require("path-that-svg").default;

or updating to v1.2.4 as a named import like

const { pathThatSvg } = require("path-that-svg");