title: React native Typescript path alias unable to resolve module
body: <p>so basically, I created my React Native with Typescript using the commandline in RN homepage:
  <code>npx react-native init MyApp --template react-native-template-typescript</code></p>
  <p>After that, I ran the project and it was built successfully.
  However, when I added the path alias to import my file, it threw an error: <code>Unable to resolve module #folder/file from  ... could not be found within the project or in these directories: node_modules</code></p>
  <p>I've <strong>already followed</strong> some tutorials and bug resolves on Google but <strong>I've met no luck.</strong></p>
  <p>Here is my <code>.babelrc</code> file (I <strong>tried to change the file</strong> from babel.config.js to .babelrc as some resolver said but it still didn't work)</p>
  <pre><code>{
    &quot;presets&quot;: [&quot;module:metro-react-native-babel-preset&quot;],
    &quot;plugins&quot;: [
      [
        &quot;module-resolver&quot;,
        {
          &quot;root&quot;: [&quot;./src&quot;],
          &quot;extensions&quot;: [
            &quot;.js&quot;,
            &quot;.jsx&quot;,
            &quot;.ts&quot;,
            &quot;.tsx&quot;,
            &quot;.android.js&quot;,
            &quot;.android.tsx&quot;,
            &quot;.ios.js&quot;,
            &quot;.ios.tsx&quot;
          ],
          &quot;alias&quot;: {
            &quot;#src/*&quot;: [
              &quot;./src/*&quot;
            ],
            &quot;#configs/*&quot;: [
              &quot;./src/config/*&quot;
            ],
            &quot;#actions/*&quot;: [
              &quot;./src/redux/actions/*&quot;
            ],
            &quot;#reducers/*&quot;: [
              &quot;./src/redux/reducers/*&quot;
            ],
            &quot;#store/*&quot;: [
              &quot;./src/redux/store/*&quot;
            ]
          }
        }
      ]
    ]
  }
  </code></pre>
  <p><code>tsconfig.json</code></p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      /* Basic Options */
      &quot;target&quot;: &quot;esnext&quot;, 
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;lib&quot;: [
        &quot;ES2017&quot;,
        &quot;DOM&quot;,
        &quot;ES2015&quot;,
        &quot;ES2015.Promise&quot;
      ], 
      &quot;allowJs&quot;: true, 
      &quot;jsx&quot;: &quot;react-native&quot;,
      &quot;noEmit&quot;: true, 
      &quot;incremental&quot;: true,
      &quot;importHelpers&quot;: true,
      &quot;isolatedModules&quot;: true,
      &quot;strict&quot;: true,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;baseUrl&quot;: &quot;.&quot;, 
      &quot;paths&quot;: {
        &quot;#src/*&quot;: [
          &quot;src/*&quot;
        ],
        &quot;#configs/*&quot;: [
          &quot;src/config/*&quot;
        ],
        &quot;#actions/*&quot;: [
          &quot;src/redux/actions/*&quot;
        ],
        &quot;#reducers/*&quot;: [
          &quot;src/redux/reducers/*&quot;
        ],
        &quot;#store/*&quot;: [
          &quot;src/redux/store/*&quot;
        ]
      }, 
      &quot;types&quot;: [&quot;jest&quot;],
      &quot;allowSyntheticDefaultImports&quot;: true, 
      &quot;esModuleInterop&quot;: true, 
      &quot;skipLibCheck&quot;: false, 
      &quot;resolveJsonModule&quot;: true 
    },
    &quot;exclude&quot;: [
      &quot;node_modules&quot;,
      &quot;babel.config.js&quot;,
      &quot;metro.config.js&quot;,
      &quot;jest.config.js&quot;
    ]
  }
  </code></pre>
  <p>My folders and files structure</p>
  <pre><code>├───assets
  ├───components
  ├───config
  │       constants.ts
  │
  └───redux
      ├───actions
      │       index.ts
      │       stateActions.ts
      │
      ├───reducers
      │       index.ts
      │       stateReducer.ts
      │
      └───store
              index.ts
  </code></pre>
  <p>Really looking forward to receive you guys answers. Thank you so much</p>
  <p>P/s: if you dont mind, please take a look at my repository:
  <a href="https://github.com/NotJackieTruong/rn_test_typescript" rel="nofollow noreferrer">https://github.com/NotJackieTruong/rn_test_typescript</a></p>