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

Bug: require loads local file instead of node_modules package

Open ruzicka opened this issue 6 years ago • 2 comments

It seems that when there is a local file called the same as an existing package (let's assume stripe package and stripe.js file) and you are trying to load the package, local file is loaded instead.

require('stripe') // loads local stripe.js file

expected behaviour:

require('stripe') // should load `stripe` package
require('./stripe') // should load local stripe.js file

ruzicka avatar Jun 08 '18 11:06 ruzicka

Hm, I'm not sure if it's caused by module-alias but will check it

ilearnio avatar Jun 08 '18 19:06 ilearnio

I'm having a similar issue, getting an error because it's trying to get a local file instead of dependency. Issue only happening when I define aliases in package.json and import module-alias/register, not when calling .addAliases() directly.

ellell avatar Aug 20 '18 15:08 ellell