Since Hyphenopoly requires an explicit loader / loaderSync function in Node and other non-browser JS runtimes, it would be great if these functions received Hyphenopoly’s module URL as a second argument, to make it easier to locate the patterns folder.
For example, percollate, which uses Hyphenopoly for hyphenation, can be run either as a standalone CLI or a Node.js dependency. As I’ve just been reminded, only the former has node_modules/hyphenopoly/patterns.
Getting import.meta.url as the second argument to the loader() / loaderSync() functions — or, even better, maybe something like new URL('./patterns', import.meta.url) — would help us prevent things like createRequire() to locate the patterns folder:
Since Hyphenopoly requires an explicit
loader
/loaderSync
function in Node and other non-browser JS runtimes, it would be great if these functions received Hyphenopoly’s module URL as a second argument, to make it easier to locate thepatterns
folder.For example, percollate, which uses Hyphenopoly for hyphenation, can be run either as a standalone CLI or a Node.js dependency. As I’ve just been reminded, only the former has
node_modules/hyphenopoly/patterns
.Getting
import.meta.url
as the second argument to theloader()
/loaderSync()
functions — or, even better, maybe something likenew URL('./patterns', import.meta.url)
— would help us prevent things likecreateRequire()
to locate the patterns folder:cc @yashha