shrhdk / text-to-svg

Convert text to SVG path without native dependence.
Other
964 stars 131 forks source link

Uncaught ReferenceError: __dirname is not defined #73

Open vdegenne opened 1 year ago

vdegenne commented 1 year ago

I am using this package in a ES Module context. When I load my project in the browser I get the follow error:

Uncaught ReferenceError: __dirname is not defined

The message is pretty obvious. First __dirname doesn't exist in es module context. Second, I think it would be better to make your package es-module compliant. Removing require replacing with import statements and trying to remove the use of path library which is not loadable in browsers.

lawik commented 9 months ago

Just fought this. Here is a PR with my suggested fix: https://github.com/shrhdk/text-to-svg/pull/76