-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 99.84 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.1.0 - ~/.nvm/versions/node/v11.1.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v11.1.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 22.0.1, 23.0.1, 25.0.0, 25.0.2, 26.0.0, 26.0.2
API Levels: 19, 21, 23, 24, 25, 26
IDEs:
Android Studio: 3.1 AI-173.4720617
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.2 => 0.57.2
npmGlobalPackages:
react-native-cli: 2.0.1
Description
I have some helper modules that live inside __tests__
directory which are also exported. Here is my directory structure. There are two packages A and B. I am exporting fileA from A's __tests__
directory and trying to use it inside B.
A
├── dist
├── node_modules
├── src
│ ├── __tests__
│ │ ├── __helpers__
│ │ │ ├── fileA.ts
│ │ └── integration.test.ts
B
├── dist
├── node_modules
├── src
│ ├── __tests__
│ │ └── integration.test.ts
But it does not resolve the module and throws following error:
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `./__tests__/__helpers__/fileA` from
`/Users/xyz/project/packages/A/dist/index.js`:
The module `./__tests__/__helpers__/fileA` could not be found from `/Users/xyz/project/packages/A/dist/index.js`. Indeed, none of these files exist:
* `/Users/xyz/project/packages/A/dist/__tests__/__helpers__/fileA(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
* `/Users/xyz/project/packages/A/dist/__tests__/__helpers__/fileA/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)`
But files do exists.
Reproducible Demo
--
Things I tried
- I tried cleaning the yarn and metro bundler's cache
- removed node_modules, cleared watchman's state