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

How to webpack a node_module for use in both React and ReactNative

$
0
0

I'm building out a library that will be used by both a React Native project and a React project as a node_module hosted on my github.

This is proving quite daunting- and based on how ugly my code has become, I feel I must be doing something wrong.

Here's the presenting problem, the most recent issue:

Failed to compile.

./node_modules/plenti-api/src/services/AccountService.ts 11:10
Module parse failed: Unexpected token (11:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| export default class AccountService {
>   private client: IClient
|   constructor(client: IClient) {
|     this.client = client

This is occurring when trying to build the React project via npm start. The project successfully builds and runs on the React Native side of things.

what do I need to put in my .tsconfig / .webpack.config.js / somethingelse in order to allow for these typescript structures to exist in my library and be imported correctly into my web project?


Viewing all articles
Browse latest Browse all 6211

Trending Articles



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