react / react/metro

[bug] Not possible to fully disable caching using Babel api

Open
#548 2 comments 4 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

Is there a way to fully disable React Native Packager caching?

We have a very small application that is only used for showing the assets. All assets files are imported automatically from special directory using babel-plugin-codegen. The problem is that these imports do not regenerate on files change. It seems that Babel just doesn't support partial caching. So, the solution is to rebuild the whole app every time it reloads in Simulator.

Unfortunately methods described in Babel docs don’t work for some reason with Metro Bundler. This is our babel.config.js

module.exports = function (api) {
  api.cache.never()

  return {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: ['macros']
  }
}

and these are our dependencies (project is created with react-native init yesterday)

"react-native": "0.62.2"
"metro-react-native-babel-preset": "^0.58.0",

Thanks for your help in advance!

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

Start with the supplied babel.config.js and the Metro React Native Babel preset at react-native 0.62.2. Reproduce the asset-import refresh problem in the Simulator, then trace how Metro and the Babel API handle api.cache.never(). Done should be a confirmed explanation and a documented or tested way to disable caching fully, if supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.