title: How to get rollup to include a dependency from another package in a lerna monorepo in its transpilation (TypeScript)?
body: <p>I created a minimal example to show the question I have: <a href="https://github.com/goepi/lru-test" rel="noreferrer">Github repo</a>. </p>
  
  <p>I have a lerna monorepo with two npm packages in the <code>packages</code> folder, the packages are called:</p>
  
  <p><strong>utils</strong>: exports a function:</p>
  
  <pre><code>export const add = (a:number, b: number) =&gt; a + b
  </code></pre>
  
  <p><strong>component-library:</strong>: exports one simple functional React component:</p>
  
  <pre><code>import React from 'react';
  import { add } from '@project/utils';
  
  export const MyComponent = () =&gt; &lt;div&gt;{add(2, 2)}&lt;/div&gt;;
  </code></pre>
  
  <p>The root of the monorepo has a <code>tsconfig.json</code>, which defines a <code>paths</code> key to map any imports of the form <code>@project/*</code> to the packages.</p>
  
  <pre><code>{
    "compilerOptions": {
      "jsx": "react",
      "esModuleInterop": true,
      "allowSyntheticDefaultImports": true,
      "moduleResolution": "node",
      "allowJs": true,
      "baseUrl": ".",
      "paths": {
        "@project/*": ["packages/*/src"]
      }
    },
    "exclude": ["**/build/**"]
  }
  </code></pre>
  
  <p>Each package has a <code>rollup.config.js</code>, both essentially identical (though we're only going to use the one in the <code>component-library</code> package here):</p>
  
  <pre><code>import typescript from '@rollup/plugin-typescript';
  import commonjs from '@rollup/plugin-commonjs';
  
  export default {
      input: 'src/index.tsx',
      output: {
          dir: './build',
          format: 'cjs'
      },
      plugins: [
          commonjs(),
          typescript({ tsconfig: '../../tsconfig.json'}),
      ]
  };
  </code></pre>
  
  <p>Therefore, they both use the paths defined in the root <code>tsconfig.json</code>, and they use a plugin for transpiling Typescript.</p>
  
  <p><code>component-library</code> imports a function from <code>@project/utils</code> called <code>add(a,b)</code>.</p>
  
  <p>My goal is to create a build of this library (using <code>rollup</code>), without having to build the <code>utils</code> package first. In other words, I want to build <code>component-library</code> resolving imports from <code>utils</code> to the source code of <code>utils</code>, not the build folder in the symlinked package in <code>node_modules</code> (ie, not using the symlinks created by lerna).</p>
  
  <p>I almost achieve this, except that when I run the build script in <code>component-library</code>, I get an error:</p>
  
  <blockquote>
    <p>src/index.tsx → ./build... [!] Error: Unexpected token (Note that you
    need plugins to import files that are not JavaScript)
    ..\utils\src\index.ts (1:21) 1: export const add = (a:number, b:
    number) => a + b
                            ^</p>
  </blockquote>
  
  <p>The way I understand this, it means that the resolution of the import works fine, but rollup is not transpiling the TS file coming from an external dependency.</p>
  
  <p><strong>How do I tell rollup to include the file from utils in the transpilation through rollup?</strong></p>