You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting an issue when using module-alias with some private npm scoped packages.
For example, given we have defined _moduleAliases configuration in package.json, it works well without any private scoped packages (which also has a name starts with @ sign).
If I import any scoped packages (in my case, the name is @org/utility), we will run into a issue like this:
Error: Cannot find module 'org/utility'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._resolveFilename (/Users/***/node_modules/module-alias/index.js:49:29)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/***/dist/utils/ccd.js:14:25)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
It looks like module-alias try to resolve this package as an alias definition while actually it's not. If I manually require package without module-alias hooked, everything works well again.
The text was updated successfully, but these errors were encountered:
Not sure exactly how private scoped packages work, but I'm not sure the problem is that module-alias is trying to load @org/utility as an alias. Unless you have @org as an alias as well, which might conflict. Using @ for aliasing is just an example, you could use $$$ instead, it would make no difference to module-alias.
Would you mind sharing your package.json ? Even better would be a git repo with everything needed to reproduce the problem.
Also, which version of node are you using ?
I am getting an issue when using
module-alias
with some private npm scoped packages.For example, given we have defined
_moduleAliases
configuration inpackage.json
, it works well without any private scoped packages (which also has a name starts with@
sign).If I import any scoped packages (in my case, the name is
@org/utility
), we will run into a issue like this:It looks like
module-alias
try to resolve this package as an alias definition while actually it's not. If I manuallyrequire
package withoutmodule-alias
hooked, everything works well again.The text was updated successfully, but these errors were encountered: