Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haste could not resolve module with dot folder in the path (.build) #325

Open
tuanmai opened this issue Dec 5, 2018 · 1 comment
Open

Comments

@tuanmai
Copy link

tuanmai commented Dec 5, 2018

Do you want to request a feature or report a bug?
It's a bug

What is the current behavior?
I added a package with the path to the main file is .build/index.js. I can run the project on local successfully, but when I try to build. It shows this error.

While trying to resolve module `redux-api-call-adapter-dedupe` from file `/Users/tuanmai/code/MetroExample/index.js`, the package `/Users/tuanmai/code/MetroExample/node_modules/redux-api-call-adapter-dedupe/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/tuanmai/code/MetroExample/node_modules/redux-api-call-adapter-dedupe/.build/index.js`. Indeed, none of these files exist:

  * `/Users/tuanmai/code/MetroExample/node_modules/redux-api-call-adapter-dedupe/.build/index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `/Users/tuanmai/code/MetroExample/node_modules/redux-api-call-adapter-dedupe/.build/index.js/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`

I tried to change the path on package.json and the folder name to build/index.js and it works normally.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
Repo: https://github.com/tuanmai/metro-error-example (just created by react-native init then add the lib with /.build/index.js path.
Steps:

  • yarn install
  • node node_modules/react-native/local-cli/cli.js bundle --platform android --reset-cache --entry-file index.js --bundle-output bundle.js --assets-dest .

What is the expected behavior?
It should work with the .build/index.js
Old metro version (0.30.2) with react native 0.55 works.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Current metro version: 0.48.3
node: v8.9.0
yarn: 1.10.1
OS: MacOS 10.14.1

@toan2406
Copy link

toan2406 commented Jul 8, 2019

I experienced this too. It's annoying that I have to clone the dependencies and change build path.

xuyuanxiang pushed a commit to xuyuanxiang/umi-react-native that referenced this issue May 20, 2020
  解决:[metro/issues/325](facebook/metro#325)
  这个问题很诡异,直接使用React Native CLI时没问题;但换用expo确加载不到文件。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants