Repository navigation
Closed
Labels
bugSomething isn't working
Description
What happened?
When you use project references TypeScript force you to build your source code. When you have clean codebase there are no builded files and @rnx-kit/metro-plugin-typescript throws error about that.
I think there should an option like in fork-ts-checker-webpack-plugin - { typescript: { build: true, mode: 'write-dts' } }
Ideally, just running metro should be enough, without separate running of tsc compliler
Affected Package
@rnx-kit/metro-plugin-typescript
Version
0.4.5
Which platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
System Information
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Max
Memory: 9.35 GB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.7.0
path: ~/.nvm/versions/node/v22.7.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v22.7.0/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v22.7.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /Users/dima/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11842104
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 2.7.6
path: /Users/dima/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: false
Steps to Reproduce
- Set-up typescript project references
- Add
@rnx-kit/metro-plugin-typescriptto your metro config - Run expo ios
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
tido64 commentedon Sep 11, 2024
Hi, this sounds like a feature request rather than something not working correctly.
@rnx-kit/metro-plugin-typescriptdoes not run in build mode, hence it does not look at project references. It's only supposed to do type checking, not build.If you're on a recent version of Metro and you're using package exports, have you tried adding a
typescriptcondition? In your Metro config, you can enableunstable_enablePackageExportsand setunstable_conditionNamesto something like['typescript', 'require', 'import', 'react-native']. This should tell Metro to look for.tsfiles instead and you won't have to build anything.aspirisen commentedon Sep 11, 2024
Tommy Nguyen (@tido64) I am not sure that this issue is connected with packages export, as I understand the error is coming from typescript type checker itself.
As I understand the plugin is supposed to allow you to do type checking by metro, if you have project references you have to run tsc manually what makes usages of
@rnx-kit/metro-plugin-typescriptuseless, because the plugin can't work without tsc running in separate terminal and this is already performing type checkingtido64 commentedon Sep 11, 2024
It isn't. I'm saying there is a solution for your scenario with package exports that avoids building altogether.
I am not opposed to adding proper support for project references, but that will be an option that we have to add. I'm not sure of the scope of this work and will have to ask someone who knows these bits better than I do.
Out of curiousity, what is the error you're seeing?
aspirisen commentedon Sep 11, 2024
Tommy Nguyen (@tido64) I have this error in clean repo
When I run
tsc --buildthe error goes away