title: TypeScript with Relay: Can't resolve generated module
body: <p>In my <code>MessageItem.tsx</code> component I have the following code:</p>
  
  <pre><code>const data = useFragment(
      graphql`
        fragment MessageItem_message on Message {
          date
          body
        }
      `,
      message as any
    );
  </code></pre>
  
  <p>After running <code>relay-compiler --src ./src --schema ../../schema.graphql --language typescript --artifactDirectory ./src/__generated__</code>, a module named <code>MessageItem_message.graphql.ts</code>  gets generated.</p>
  
  <p>But when I run the app it gives me an error:</p>
  
  <blockquote>
    <p>Failed to compile.</p>
    
    <p>./src/components/MessageItem.tsx</p>
    
    <p>Module not found: Can't resolve
    './__generated__/MessageItem_message.graphql'</p>
  </blockquote>
  
  <p>The reason is only components at the src root can refer to the right path (<code>./__generated__</code>), whereas components in a folder actually need to refer to the path (<code>../__generated__</code>) but it's not doing so.</p>
  
  <p>How can I configure the path?</p>