Microbundle: (rpt2 plugin) Error: Could not find source file: .../dist/index.d.ts

Created on 20 May 2020  路  7Comments  路  Source: developit/microbundle

I have only one file in src/index.ts

{
  "name": "react-modern-calendar",
  "version": "0.0.1",
  "license": "MIT",
  "source": "src/index.ts",
  "main": "dist/index.js",
  "module": "dist/index.module.js",
  "unpkg": "dist/index.umd.js",
  "types": "dist/index.d.ts",
  "scripts": {
    "build": "microbundle",
    "dev": "microbundle watch"
  }
}
$ microbundle
rpt2: options error TS6053: File '/mnt/ssd/repositories/react-modern-calendar/dist/index.d.ts' not found.
(rpt2 plugin) Error: Could not find source file: '/mnt/ssd/repositories/react-modern-calendar/dist/index.d.ts'.
Error: Could not find source file: '/mnt/ssd/repositories/react-modern-calendar/dist/index.d.ts'.
    at getValidSourceFile (/mnt/ssd/repositories/react-modern-calendar/node_modules/typescript/lib/typescript.js:139148:29)
    at Object.getEmitOutput (/mnt/ssd/repositories/react-modern-calendar/node_modules/typescript/lib/typescript.js:139533:30)
    at /mnt/ssd/repositories/react-modern-calendar/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27438:40
    at arrayEach (/mnt/ssd/repositories/react-modern-calendar/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:534:11)
    at forEach (/mnt/ssd/repositories/react-modern-calendar/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9360:14)
    at Object._onwrite (/mnt/ssd/repositories/react-modern-calendar/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27429:13)
    at Object.generateBundle (/mnt/ssd/repositories/react-modern-calendar/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27402:27)
    at /mnt/ssd/repositories/react-modern-calendar/node_modules/rollup/dist/shared/node-entry.js:13117:25
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

The solution is to remove the dist after every build.

needs more info

Most helpful comment

@marvinhagemeister Whoaaa! Youre insane, thanks so much for working out the fixes already!

W眉nsche dir f眉r morgen einen guten Wochenstart (:

All 7 comments

What does your tsconfig.json look like?

0 configuration TypeScript support

I have no tsconfig. :smile:

I was trying out microbundle 0.12.0 this afternoon and happend to have a similar error, well actually multiple ones.

The demo repo can be found here: https://github.com/katywings/microbundle-test

To get errors you can run the one of the following "reproductions":

(rpt2 plugin) Error: Could not find source file: 'XYZ/microbundle-test/dist/dist/main.umd.d.ts'.

  1. ./scripts/build.js
  2. ./scripts/build.js

(yupp running the build twice results in an error)

(rpt2 plugin) Error: Could not find source file: 'XYZ/microbundle-test/dist/coverage/lcov-report/prettify.d.ts'.

  1. ./scripts/coverage.js
  2. ./scripts/build.js

It looks like microbundle is processing a lot of files/folders from the project root which it shouldnt even be targetting, like the coverage folder. Also microbundle saves the types in "dist/dist" instead of "dist" xD.

Downgrading to 0.11 "fixes" these problems.

@katywings Awesome, thanks a bunch for the reproduction case. With it I was able to quickly understand the issue and found a solution :+1: :100:

@marvinhagemeister Whoaaa! Youre insane, thanks so much for working out the fixes already!

W眉nsche dir f眉r morgen einen guten Wochenstart (:

@katywings Yeah, a repro case is worth its weight in gold :raised_hands:

Danke, das w眉nsche ich Dir auch! ;)

Thanks you both 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skipjack picture skipjack  路  11Comments

omgovich picture omgovich  路  16Comments

gamtiq picture gamtiq  路  28Comments

zzswang picture zzswang  路  14Comments

smithki picture smithki  路  19Comments