简体   繁体   中英

Using TS absolute paths in import statement triggers an error in react-native

I am currently converting relative paths to absolute paths in my React-Native app and it triggers the following error: Error response to absolute import

And I have set up my tsconfig.json as follows:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@buttons/*": ["src/components/buttons/*"]
    },
    "jsx": "react",
    "resolveJsonModule": true
  }
}

The following statement is how it looks in the file that I am importing it in:

import {CoreButton} from '@buttons/CoreButton';

Any ideas or suggestions would be amazing :)

The solution to this problem has been found at the following link:

React native Typescript path alias unable to resolve module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM