Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Unresolved path alias with React Native, Metro, Typescript #116

Open
KhubaibQaiser opened this issue Sep 16, 2020 · 1 comment
Open

Unresolved path alias with React Native, Metro, Typescript #116

KhubaibQaiser opened this issue Sep 16, 2020 · 1 comment

Comments

@KhubaibQaiser
Copy link

Hi, I am getting this error while resolving path aliases in my react native project. You can find the repository here: https://github.com/KhubaibQaiser/rn-seed

Is there anything wrong with the configuration of my .eslintrc.js file?

@aprilmintacpineda
Copy link

aprilmintacpineda commented Oct 29, 2020

Same here, I get that error as well, I have something like _screens as my alias, but eslint complains that it's not found, I'm not using TypeScript.

on .eslintrc.js

settings: {
  react: {
    version: 'detect'
  },
  'import/ignore': ['react-native'],
  'import/resolver': {
    'babel-module': {
      alias
    }
  }
}

import aliases:

module.exports = {
  _components: './src/components',
  _screens: './src/screens',
  _fluxible: './src/fluxible',
  _graphql: './src/graphql',
  _root: './src'
};

on babe.config.js

const alias = require('./importAliases');

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        root: ['./src'],
        alias
      }
    ]
  ],
  env: {
    production: {
      plugins: ['react-native-paper/babel']
    }
  }
};

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants