title: react native - absolute import with alias name in package.json
body: <p>I saw some projects using <code>import '@someDir/something'</code>, which solves the relative import evil.</p>
  
  <p>Then I found this <a href="https://medium.com/@davidjwoody/how-to-use-absolute-paths-in-react-native-6b06ae3f65d1" rel="noreferrer">blog post</a> talking about this method. It basically tells you to create <code>package.json</code> in directories and specify their alias names.</p>
  
  <p>I implemented it in my react-native project, which is based on expo, and it works well.</p>
  
  <p>Something like this:</p>
  
  <pre><code>{"name": "@someDir"}
  </code></pre>
  
  <p>inside <code>src/someDir/package.json</code>.</p>
  
  <p>And I can <code>import '@someDir/something'</code> everywhere.</p>
  
  <p><strong>Why is this working? Where is the magic happening behind? Webpack or babel or react-native itself?</strong></p>
  
  <p>I saw <a href="https://github.com/facebook/create-react-app/issues/741" rel="noreferrer">an issue</a> discussing about this feature but I don't know where is it implemented.</p>
  
  <p>My <code>.babelrc</code>:</p>
  
  <pre><code>{
    "presets": ["babel-preset-expo"],
      "env": {
          "development": {
                "plugins": ["transform-react-jsx-source"]
        }
      }
  }
  </code></pre>
  
  <p>It digged into the babel dependecies but cannot find anything related.</p>