universal-future / vxrn

A collection of Vite packages enabling developing and building applications for React Native on web and native platforms (iOS and Android).
https://vxrn.dev
Other
625 stars 11 forks source link

How can we deal with flow files in dependencies? #13

Open sbalay opened 9 months ago

sbalay commented 9 months ago

Hey @natew 👋

I was trying vxrn in one of my projects and saw the following error:

[commonjs--resolver] Unexpected token (15:12) in /Users/sebastianbalay/src/github.com/Shopify/shop-client/node_modules/@react-native-community/push-notification-ios/js/index.js
file: /Users/sebastianbalay/src/github.com/Shopify/shop-client/node_modules/@react-native-community/push-notification-ios/js/index.js:15:12
13: import {NativeEventEmitter, NativeModules} from 'react-native';
14: import invariant from 'invariant';
15: import type {
                ^
16:   NotificationAlert,
17:   NotificationRequest,

I guess the error makes sense since the file is actually written in flow. Does vxrn support imports from these files?

natew commented 9 months ago

You’d need to configure vite plugin flow for that dependency. But I’d like to make vxrn automatically do this, so we can make a PR that configured that out of the box. We should also very strongly pester that library to fix it, it’s a terrible practice to publish flow directly.