title: ES6 modules implementation, how to load a json file
body: <p>I'm implementing an example from  <a href="https://github.com/moroshko/react-autosuggest" rel="noreferrer">https://github.com/moroshko/react-autosuggest</a></p>
  
  <p>Important code is like this:</p>
  
  <pre><code>import React, { Component } from 'react';
  import suburbs from 'json!../suburbs.json';
  
  function getSuggestions(input, callback) {
    const suggestions = suburbs
      .filter(suburbObj =&gt; suburbMatchRegex.test(suburbObj.suburb))
      .sort((suburbObj1, suburbObj2) =&gt;
        suburbObj1.suburb.toLowerCase().indexOf(lowercasedInput) -
        suburbObj2.suburb.toLowerCase().indexOf(lowercasedInput)
      )
      .slice(0, 7)
      .map(suburbObj =&gt; suburbObj.suburb);
  
    // 'suggestions' will be an array of strings, e.g.:
    //   ['Mentone', 'Mill Park', 'Mordialloc']
  
    setTimeout(() =&gt; callback(null, suggestions), 300);
  }
  </code></pre>
  
  <p>This copy-paste code from the example (that works), has an error in my project:</p>
  
  <pre><code>Error: Cannot resolve module 'json' in /home/juanda/redux-pruebas/components
  </code></pre>
  
  <p>If I take out the prefix json!:</p>
  
  <pre><code>import suburbs from '../suburbs.json';
  </code></pre>
  
  <p>This way I got not errors at compile time (import is done).
  However I got errors when I execute it:</p>
  
  <pre><code>Uncaught TypeError: _jsonfilesSuburbsJson2.default.filter is not a function
  </code></pre>
  
  <p>If I debug it I can see suburbs is an objectc, not an array so filter function is not defined.</p>
  
  <p>However in the example is commented suggestions is an array. If I rewrite suggestions like this, everything works:</p>
  
  <pre><code>  const suggestions = suburbs
    var suggestions = [ {
      'suburb': 'Abbeyard',
      'postcode': '3737'
    }, {
      'suburb': 'Abbotsford',
      'postcode': '3067'
    }, {
      'suburb': 'Aberfeldie',
      'postcode': '3040'
    } ].filter(suburbObj =&gt; suburbMatchRegex.test(suburbObj.suburb))
  </code></pre>
  
  <p>So... what json! prefix is doing in the import? </p>
  
  <p>Why can't I put it in my code? Some babel configuration?</p>