-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Hello,
We are trying to work around import/order for our codebase but we face some difficulties as it seems that some external
dependencies are recognised as internal
.
We are using typescript and this makes imports a bit more peculiar, as when we try to import a package without types we most likely use the @types
package for it (if it exists). This brings 2 problems:
-
First one, packages like
react
when analysing the path will be in a path like:../../node_modules/@types/react
instead of../../node_modules/react
, hence thepath.indexOf
function will fail asnode_modules/react
can't be found. We could say that there is a workaround this usingimport/external-modules-folder
setting, pass bothnode_modules
andnode_modules/@types
and it works. But this does not solve our second issue: -
When a package with a name such as
@loadable/component
does not export types and we need to fetch it from@types
, there is a impossibility to declare 2 workspaces (@types/@loadable/component
), and so it instead becomes@types/loadable__component
. Which breaks the rule that try to find@loadable/components
in the path.
Is there a work around this? I feel that to classify if a path is external it should be enough by checking if the folder directory appears in the path instead of check for folder\package
what requires you to start having workarounds.