question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work with customized project root

See original GitHub issue

Hiya, I have a RN 0.59.2 project with config that looks like this:

const path = require("path");

const { getDefaultConfig } = require("metro-config");

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts }
  } = await getDefaultConfig();

  return {
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: false
        }
      }),
      babelTransformerPath: require.resolve("react-native-svg-transformer")
    },
    resolver: {
      assetExts: assetExts.filter(ext => ext !== "svg"),
      sourceExts: [...sourceExts, "svg"],

      extraNodeModules: {
        shared: path.resolve(__dirname, "../shared")
      }
    },
    // Move the project root up a level so we can access /shared, otherwise the packager can't access those assets.
    projectRoot: path.resolve(__dirname, "../")
  };
})();

I’m seeing the same issue from #14, but as far as I can tell the only difference between our configs is the moved project root and extra node module. Any ideas?

Dependencies:

"react": "16.8.3",
"react-native": "^0.59.2",
"react-native-svg": "^9.3.7",
"react-native-svg-transformer": "^0.12.1",

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
AnimaSAcommented, Apr 2, 2019

Following up on this, I was running my packager with react-native start. As it turns out, RNCLI does not care about metro.config.js when you run it this way. Mind boggling.

Edit: Unless you pass --config metro.config.js Then it’ll load. Brilliant.

0reactions
kristerkaricommented, May 14, 2020

@AshwinMekala I’m trying to keep the README as clean as possible, and this seems to be either a bug in some version of React Native CLI, or related to some very specific configuration.

I need some kind of example/demo of the exact problem that helps me to verify it before it can be added to the README.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle: getting the root project directory path when starting ...
I got past this problem by ensuring Java userDir was set to the project directory (i.e. project.projectDir ) at the top of my...
Read more >
Content roots | IntelliJ IDEA Documentation - JetBrains
Create a content root for your project and configure a folder structure for your production code, your tests, and resource files.
Read more >
Manage projects - GitLab Docs
Most work in GitLab is done in a project. Files and code are saved in projects, and most features are in the scope...
Read more >
Custom Root Causes | BIM 360 - Autodesk Knowledge Network
Inactive custom root causes cannot be used in a new issue, but they remain part of issues they are currently assigned to.
Read more >
IDE Features — Elpy 1.35.0 documentation
Set the current project root directory. This directory should contain all files related to the current project. elpy-project-ignored-directories (Customize ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found