ds300/react-native-typescript-transformer

Module `@components/Hello` does not exi st in the Haste module map

fantasy525 opened this issue · 6 comments

my tsconfig.json

...
 "paths": {
      "@components/*":["src/components/*"]
    }, 
...

and my app.tsx

import Hello from '@components/Hello'

and tsc check is no errors but bundling failed

error: bundling failed: Error: Unable to resolve module `@components/Hello` f
rom `F:\RN\TS\UserTrain\src\App.tsx`: Module `@components/Hello` does not exi
st in the Haste module map

why?

I'm facing the same issue.

tsconfig.json

"baseUrl": "./src", 
"paths": {
    "@/*": ["/*"],
    "@components": ["components"],
    "@components/*": ["components/*"],

SomeComponent.tsx

import { StyledText, StyledButton } from "@components";
error: bundling failed: Error: Unable to resolve module `@components` from `/Users/xxx/project-name/src/components/Partner/Partner.tsx`: Module `@components` does not exist in the Haste module map

Im also having this problem, did you find solution for this? @FabianMeul, @fantasy525?

Lxxyx commented

Same issue, any updates?

Add the package.json file to the components (target) directory with following content:

{
  "name": "@components",
  "private": true
}

(I'm not sure about @ in the package name)

Lxxyx commented

@fantasy525 @FabianMeul @tkulpa
By follow @stepankoci reply, Issue resolved.

@fantasy525 @FabianMeul @tkulpa
By follow @stepankoci reply, Issue resolved.
nice ,it works for me