module-alias icon indicating copy to clipboard operation
module-alias copied to clipboard

loading module-alias when using esm

Open TOTOChadi opened this issue 2 years ago • 0 comments

So , module-alias works pretty well when using it in a dev enviroment when used like this in package.json : node -r esm -r module-alias/register index.js . but as soon as i want to generate a bin eg : "bin": { "express-cli": "./index.js" }, i get an error when trying to execute the command specifying that it can't find my packages :

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'classes' imported from /home/chadist/Desktop/express-gen/index.js at new NodeError (node:internal/errors:371:5) at packageResolve (node:internal/modules/esm/resolve:845:9) at moduleResolve (node:internal/modules/esm/resolve:890:18) at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:1004:11) at Loader.resolve (node:internal/modules/esm/loader:89:40) at Loader.getModuleJob (node:internal/modules/esm/loader:242:28) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36) { code: 'ERR_MODULE_NOT_FOUND' }

any idea how can i load the script when executing the command?

TOTOChadi avatar Jul 28 '22 12:07 TOTOChadi