Closed mfventura closed 9 months ago
having the same exact issue, somehow it seems like "lib" folder in version 1.73.0-rc.4 does not exists. check package.json > "main": "lib/index.js"
having the same exact issue, somehow it seems like "lib" folder in version 1.73.0-rc.4 does not exists. check package.json > "main": "lib/index.js"
Yes, I saw it, but I don's really know how to fix it (I´m more related with Java in backend projects).
Were you able to fix that? Maybe using a minor version?
Well... I rolled back to version to rc3, the lib folder exists in this RC and no initial errors but upon running metro I see that TS types are messed up. Its not good..
Try: npm install react-native-bluetooth-classic@1.73.0-rc.3
Yes, trying that, I get an error on runtime.
error: Error: Unable to resolve module ../node_modules/react-native/types/index from /Users/theam/personal-projects/cabritas/node_modules/react-native-bluetooth-classic/lib/index.js:
None of these files exist:
* node_modules/react-native-bluetooth-classic/node_modules/react-native/types/index(.android.jsx|.native.jsx|.jsx|.android.js|.native.js|.js|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.cjs|.native.cjs|.cjs|.android.json|.native.json|.json)
* node_modules/react-native-bluetooth-classic/node_modules/react-native/types/index/index(.android.jsx|.native.jsx|.jsx|.android.js|.native.js|.js|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.cjs|.native.cjs|.cjs|.android.json|.native.json|.json)
1 | import { NativeModules } from "../node_modules/react-native/types/index";
| ^
2 | import BluetoothDevice from "./BluetoothDevice";
3 | import BluetoothError from "./BluetoothError";
4 | import { BluetoothEventType, } from "./BluetoothEvent";
at ModuleResolver.resolveDependency (/Users/theam/personal-projects/cabritas/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:127:15)
at DependencyGraph.resolveDependency (/Users/theam/personal-projects/cabritas/node_modules/metro/src/node-haste/DependencyGraph.js:271:43)
at /Users/theam/personal-projects/cabritas/node_modules/metro/src/lib/transformHelpers.js:176:21
at resolveDependencies (/Users/theam/personal-projects/cabritas/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
at visit (/Users/theam/personal-projects/cabritas/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
at async Promise.all (index 9)
at async visit (/Users/theam/personal-projects/cabritas/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
at async Promise.all (index 2)
at async visit (/Users/theam/personal-projects/cabritas/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
at async Promise.all (index 0)
I will try with RC2 and see
RC2 and RC1 don't exist.
Rc4 is using the typescript parent from react native. Which probably has a different dist folder configured and why the lib folder is missing. So obviously fucked up while attempting to fox old dependencies.
I'm on vacation and can accept a pr, but can't do much else. If you're looking into it, check the typescript folder as this is probably where the lib issue is.
Rc3 has imports pointing to the types and not the actual code, vscode "fixed" this when I first removed the @types/reactnative in favor of the built in types.
Looking at the tsconfig it's still got /lib as the outdir. So that seems fine. It looks like /lib is in the git ignore, which I can't remember if this causes issues for npm as well.
I have cloned the package and ran tsc but there is no output. It seems like tsc is not outputting lib folder. Looking at "noEmit" flags etc at the moment. By the way I noticed you extend tsconfig flags from "@tsconfig/react-native/tsconfig.json" in 0.73 this was replaced with: "@react-native/typescript-config/tsconfig.json" I suggest this is replaced. If I have any update I will let you know.
$ tsc --build --verbose
[16:51:18] Projects in this build:
* tsconfig.json
[16:51:18] Project 'tsconfig.json' is out of date because output file 'lib/BluetoothDevice.js' does not exist
Interesting output from tsc.
Ah I tried to update the npm ignore to force the lib dir. When I tested locally last it compiled OK. Open a pr of you get it built.
Opened a PR to fix file emitting please review: https://github.com/kenjdavidson/react-native-bluetooth-classic/pull/303
I have tested locally with local npm package publish and works fine. Try building yourself: npx tsc --build --verbose
Merged and kicked off release. Appreciate the help. And sorry for the last few builds. My bad.
Thanks for fast response. I can confirm that tsc is outputting it properly now and I can use the package in 0.73^.
When I pulled the package I had a different TS error this time, I have corrected the NativeModule import path, please review: https://github.com/kenjdavidson/react-native-bluetooth-classic/pull/304
With this fix all issues should be resolved for now.
Sorry was pool side. Merged and released.
It seems like import issue is still persisting. I have checked the lib/index.js but old import statement is still there.
After my PR it should have been like this:
Is it possible that you might have forgotten run tsc?
For example I created this package for myself to test issues, if you check lib/index.js you will find corrected import statement: https://www.npmjs.com/package/@alihanpehlivan/react-native-bluetooth-classic
I would take a look at the github action. This is what builds and releases the library. If it's not correct with the latest changes it may be wrong.
It seems like last time actions worked was 6:40pm UK time. My latest PR was at around 7:20pm. I think actions did not take the latest change. Not sure how did that happen.
Kicked it off again.
There we go, now that worked! Not sure why it did not kick off properly tsc when you merged into master, interesting. I can see index.js updated now.
I can confirm that all issues related to imports & srcs are resolved now and I have tested it with my devices. I'm glad I can put all our teams projects on 0.73 now.
Thanks for maintaining the library, enjoy your holiday! 😃
No. Thank you. I don't do a lot with this anymore.But I'm glad it's used.
Mobile Device Environment Provide a list of operating systems on which this issue is relevant.
Application Environment Provide information about your development environment:
Describe the bug When I try to import the components from 'react-native-bluetooth-classic', it´s not possible to run the app. I get a trace that says:
To Reproduce
Expected behavior I expected to see the TestBT.tsx text without errors.