Skip to content

Dynamic require in dependencies breaking apps with version 0.49.0 #16198

@tinkrtailor

Description

@tinkrtailor

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.5
Node: 7.10.0
Yarn: 0.24.5
npm: 4.2.0
Watchman: 4.7.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.49.0 => 0.49.0

Steps to Reproduce

prerequisite: Have a react-native app with version 0.49.0

  1. Install and use a package with dynamic imports statements such as moment.js
  2. Run the app
  3. Witness red screen of death notifying of TransformError

Expected Behavior

I expected the project to build and run as it did for the RN version I was using before (0.48.4).

Actual Behavior

I got an error saying that a require() must have a string literal argument. Even though the responsible for this error was located in the source code of a dependency (Moment.js)
require('./locale/' + name);

screen shot 2017-10-04 at 11 20 19

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions