Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

Typescript babel-plugin-module-resolver

$
0
0

Hello is there an equivalent of babel-plugin-module-resolver for typescript.I am trying to resolve "react-native" to "react-native-web". Example below.

import { View } from "react-native"// should resolve to to once compiled or run using ts-node or ts-loaderimport { view } from "react-native-web"

I have tried solving the issue for a while before asking the question with no success. Here's what I've tried.

first attempt: - unsuccessful

// tsconfig.json"baseUrl": "./""paths": {"react-native": ["node_modules/react-native-web"]},"skipLibCheck": true

second attempt: using Babel as a translator: successful but not ideal or elegant. Issues when using vscode debug due to an issue when pass .tsx, .ts extensions to the babel-node even with the --extensions ".ts,tsx" flag.

// .babelrc{"plugins": ["@babel/plugin-proposal-class-properties","@babel/plugin-proposal-object-rest-spread"    ],"presets": ["@babel/preset-env","@babel/preset-react","@babel/preset-typescript"    ]}

does anyone have any ideas? Any help would be much appreciated.


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>