words / syllable

Count syllables in an English word
https://words.github.io/syllable/
MIT License
223 stars 23 forks source link

Make syllable work in browser? #48

Closed davidyang closed 3 years ago

davidyang commented 3 years ago

I wasn't able to make this work in the browser (because normalize-strings uses require).

I was able to browserify it but it was a bit tricky, the command I used is as follows:

browserify index.js -p esmify -s syllable -o syllable-browser.js

That creates a global variable called syllable that you can use like syllable.syllable(word). Not the most elegant but just wanted something quick and dirty.

wooorm commented 3 years ago

Hi there!

We’re not yet in an place where dependencies can be used in browsers without a build step.

I suggest using esbuild, it’s fast: https://esbuild.github.io. Alternatively, indeed, browserify with a couple of steps.