react / react/metro

Metro doesn't package ressources when require is aliased in release mode

Open
#622 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

Do you want to request a feature or report a bug?
A bug

What is the current behavior?
When require is aliased, requiring a ressource (for example an image) fails when package RN app in release mode. Aliased requires works in dev mode though...

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.
Simply do that:

var temp1 = require;

// ...

return (
    <Image source={temp1("path to pic file")} />
);

What is the expected behavior?
That should work in both release and debug/dev.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

  • OS X 11.1 Big sur
  • react-native 0.63.3
  • yarn 1.22.10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing the aliased require with an image in a release build, then compare Metro's resource handling with dev mode; done means the resource is packaged and loads successfully in both modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.