title: rollup-plugin-dts leaves leftover d.ts files
body: <p>Very trivial problem it seems. I have a rollup typescript config using rollup-plugin-typescript and rollup-plugin-dts. I want to bundle all my d.ts files into one d.ts file instead of having it mirroring my project structure. I followed some tutorials and ended up with the configs below.</p>
  <p>The problem: dts() bundles the file correctly but leaves the original build structure as is. None of my resources addresses this. Shouldn't the now obsolete input files be deleted? Am I handling the plugin badly?</p>
  <p>Where I start:</p>
  <pre><code>dist/
  ├── index.js 
  ├─ dts //I compile my types into here, below is my mirrored project structure
      ├── components
      │   ├── Button.d.ts
      │   ├── index.d.ts
      ├── index.d.ts
  </code></pre>
  <p>What I want:</p>
  <pre><code>dist/
  ├── index.js 
  ├── index.d.ts //everything bundled here
  </code></pre>
  <p>Unfortunately what I get:</p>
  <pre><code>dist/
  ├── index.js 
  ├─ dts //All of this is still here, it shouldn't be
      ├── components
      │   ├── Button.d.ts
      │   ├── index.d.ts
      ├── index.d.ts
  ├── index.d.ts //It bundled correctly to this additional file though
  </code></pre>
  <p>tsconfig.json</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      &quot;allowJs&quot;: true,
      &quot;allowSyntheticDefaultImports&quot;: true,
      &quot;declaration&quot;: true,
      &quot;declarationDir&quot;: &quot;dts&quot;,
      &quot;downlevelIteration&quot;: true,
      &quot;esModuleInterop&quot;: true,
      &quot;forceConsistentCasingInFileNames&quot;: true,
      &quot;isolatedModules&quot;: true,
      &quot;jsx&quot;: &quot;react-jsx&quot;,
      &quot;lib&quot;: [&quot;dom&quot;, &quot;dom.iterable&quot;, &quot;esnext&quot;],
      &quot;module&quot;: &quot;esnext&quot;,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;noEmit&quot;: true,
      &quot;noFallthroughCasesInSwitch&quot;: true,
      &quot;noImplicitAny&quot;: true,
      &quot;resolveJsonModule&quot;: true,
      &quot;skipLibCheck&quot;: true,
      &quot;sourceMap&quot;: true,
      &quot;strict&quot;: true,
      &quot;target&quot;: &quot;es5&quot;,
      &quot;strictFunctionTypes&quot;: true
    },
    &quot;include&quot;: [&quot;src/&quot;],
    &quot;exclude&quot;: [&quot;node_modules&quot;, &quot;build&quot;, &quot;dist&quot;, &quot;src/stories/**&quot;, &quot;**/*.stories.ts&quot;, &quot;**/*.test.ts&quot;, &quot;**/*.test.tsx&quot;]
  }
  </code></pre>
  <p>rollup.config.js</p>
  <pre><code>import babel from 'rollup-plugin-babel';
  import resolve from '@rollup/plugin-node-resolve';
  import external from 'rollup-plugin-peer-deps-external';
  import { terser } from 'rollup-plugin-terser';
  import commonjs from '@rollup/plugin-commonjs';
  import dts from 'rollup-plugin-dts';
  import typescript from '@rollup/plugin-typescript';
  
  export default [
      {
          input: './src/index.ts',
          output: [
              {
                  file: 'dist/index.js',
                  format: 'cjs',
              },
              {
                  file: 'dist/index.es.js',
                  format: 'es',
                  exports: 'named',
              },
          ],
          plugins: [
              typescript({
                  tsconfig: './tsconfig.json',
              }),
              babel({
                  exclude: 'node_modules/**',
                  presets: ['@babel/preset-react'],
              }),
              resolve(),
              commonjs(),
              external(),
              terser(),
          ],
      },
      {
          input: './dist/dts/index.d.ts',
          output: [{ file: 'dist/index.d.ts', format: 'es' }],
          plugins: [dts()],
      },
  ];
  </code></pre>