title: How to use babel-plugin-module-resolver to set an alias for the root path and disable other root imports?
body: <p>I would like to do imports like this <code>import Foo from '~/components/Foo'</code></p>
  
  <p><a href="https://github.com/tleunen/babel-plugin-module-resolver" rel="nofollow noreferrer">https://github.com/tleunen/babel-plugin-module-resolver</a></p>
  
  <p>If I set my <code>.babelrc</code> to:</p>
  
  <pre><code>{
    "plugins": [
      ["module-resolver", {
        "root": "./",
        "alias": {
          "~/": "./"
        }
      }]
    ]
  }
  </code></pre>
  
  <p>I have also tried (and lots of other combinations):</p>
  
  <pre><code>{
    "plugins": [
      ["module-resolver", {
        "root": ".",
        "alias": {
          "~": "."
        }
      }]
    ]
  }
  </code></pre>
  
  <p>Then I can use it in scripts like so:</p>
  
  <pre class="lang-js prettyprint-override"><code>import Foo from 'components/Foo'
  </code></pre>
  
  <ol>
  <li>It doesn't work if I do <code>import Foo from '~/components/Foo'</code> (I would expect it to)</li>
  <li>I want to <strong>force</strong> users to have to prepend the <code>~/</code> so there aren't multiple usage patterns.</li>
  </ol>