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

Metro Bundler cannot find .hidden.js files. #24020

Closed
mafelix opened this issue Mar 18, 2019 · 2 comments
Closed

Metro Bundler cannot find .hidden.js files. #24020

mafelix opened this issue Mar 18, 2019 · 2 comments
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@mafelix
Copy link

mafelix commented Mar 18, 2019

🐛 Bug Report

  • Everytime I tried to compile a release build for android, the bundler would always error at the same point - unable to resolve a require('../.env.js') statement in one of the component files.

  • I have double checked the filepath - it is correct.

  • I have double checked the metro/src/blacklist.js - there is no explicit blacklist of hidden javascript files.

  • The hidden file is in the rootProject directory - It should be picked up and not 'outside' the project

  • The metro bundler picks up the .env.js file in developer mode though, just not in release. I ended up having to unhide the file for the bundler to pick it up and compile a release apk.

  • I should note that I recently upgraded from react native 0.38 => react-native 0.59.1. So maybe the upgrade process is the reason why the ./gradlew assembleRelease doesn't work with the hidden env file.

To Reproduce

  • Compile a release.apk that has an import / require to a valid hidden js file

Expected Behavior

  • Development behaviour should mimic release behaviour behaviour as much as possible. If the metro bundler picks up the hidden env file in development, it should always pick it up during the release compile process.

Code Example

Environment

info
  React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 26.19 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.9.0 - /usr/local/bin/node
      npm: 6.5.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 21, 22, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.3, 25.0.2, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.0, 28.0.0, 28.0.1, 28.0.2, 28.0.3
        System Images: android-19 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.1 => 0.59.1
    npmGlobalPackages:
      eslint-plugin-react-native: 3.6.0
      pushwoosh-react-native-plugin: 5.13.1
      react-native-app-auth: 2.6.1
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-map: 0.0.1
      react-native-permissions: 0.2.5
      react-native-rename: 2.2.2

package.json dependencies:

"dependencies": {
    "@babel/core": "^7.1.2",
    "create-react-class": "^15.6.3",
    "metro-react-native-babel-preset": "0.51.0",
    "moment": "^2.15.1",
    "moment-timezone": "^0.5.12",
    "prop-types": "^15.7.2",
    "pushwoosh-react-native-plugin": "^5.13.1",
    "react": "16.8.3",
    "react-native": "0.59.1",
    "react-native-camera": "git://github.com/react-native-community/react-native-camera.git#fd87a3475aedf64243fc0cc5f225dcbf2484bbab",
    "react-native-datepicker": "^1.7.2",
    "react-native-deprecated-custom-components": "^0.1.2",
    "react-native-device-info": "^0.24.3",
    "react-native-dismiss-keyboard": "^1.0.0",
    "react-native-drawer-layout": "^2.0.0",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-maps": "^0.23.0",
    "react-native-timer": "^1.3.6",
    "react-timer-mixin": "^0.13.4"
  }
@react-native-bot
Copy link
Collaborator

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write `[skip envinfo]` alongside an explanation in your Environment: section.

@cpojer
Copy link
Contributor

cpojer commented Mar 20, 2019

This issue has been moved to facebook/metro#376.

@cpojer cpojer closed this as completed Mar 20, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 20, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

3 participants