Our team has built a small CLI used for maintenance. The package.json specifies a path for with the bin
property, and everything works great; "bin": { "eddy": "./dist/src/cli/entry.js"}
Autocompletion is achived by using yargs@17.0.1
. However we recently converted the project to use es6 modules, because of a migration to Sveltekit, i.e. the package.json now contains type: module
. Because of this, the CLI now only works if we run with:
what works
node --experimental-specifier-resolution=node ./dist/src/cli/entry.js help
However, if we run this without the flag, we get an error "module not found":
Error [ERR_MODULE_NOT_FOUND]: Cannot find module...
So the question is
Can we somehow "always" add the experimental-specifier-resolution=node
to the CLI - so we can continue to use the shorthand eddy
, and utilize auto completion?