NodeRequirer icon indicating copy to clipboard operation
NodeRequirer copied to clipboard

Bug when requiring a namespaced dependency

Open jormaechea opened this issue 5 years ago • 1 comments
trafficstars

The bug is in the utils, when it tries to determine wheter a module is local or not.

https://github.com/ganemone/NodeRequirer/blob/4eed13a166cb5a8842fa84077abc66e50250db45/src/utils.py#L70-L71

For example, for a npm package @someNamespace/package it breaks.

is_local_file should make a better check, for example that it starts with (or includes) a dot.

jormaechea avatar Apr 08 '20 15:04 jormaechea

Probably related: in this scenario one can clearly see that NodeRequirer see as valid (green) che second one, which is not the right way to import it - and also marked red by eslint. The first one which actually works is not seen as valid.

To be fair, the main level require like require('@ildella/frankie-lib/') would actually work in NodeRequirer. It is the internal module, which is properly define in the package.json exports field, to not be seen as valid.

Screenshot from 2024-08-30 17-02-33 Screenshot from 2024-08-30 17-02-06

ildella avatar Aug 31 '24 07:08 ildella