Skip to content

Could not find source file when running in watch mode with rollup-plugin-vue #271

@danielvy

Description

@danielvy

What happens and why it is wrong

When running rollup in watch mode, the project will initially compile but changes to some files that trigger rollup watch, will cause a source file not found error from rp2:

[!] (plugin rpt2) Error: Could not find source file: '/<path removed>/watch-err/source/lib/module1.ts'.
Error: Could not find source file: '/<path removed>/watch-err/source/lib/module1.ts'.
    at getValidSourceFile (/<path removed>/watch-err/node_modules/typescript/lib/typescript.js:153646:29)
    at Object.getSyntacticDiagnostics (/<path removed>/watch-err/node_modules/typescript/lib/typescript.js:153896:52)
    at /<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/index.ts:306:23
    at TsCache.getDiagnostics (/<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/tscache.ts:298:49)
    at TsCache.getSyntacticDiagnostics (/<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/tscache.ts:238:15)
    at /<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/index.ts:304:15
    at /<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/tscache.ts:183:61
    at arrayEach (/<path removed>/watch-err/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:516:11)
    at Function._.each [as forEach] (/<path removed>/watch-err/node_modules/rollup-plugin-typescript2/node_modules/lodash/lodash.js:9368:14)
    at TsCache.walkTree (/<path removed>/watch-err/node_modules/rollup-plugin-typescript2/src/tscache.ts:183:4)

Repository with reproduction code

Steps to reproduce:

  1. Run rollup -c rollup.config.js --watch
  2. Trigger rollup watch by re-saving module2.ts or index.ts. Note that triggering watch with module1.ts will not produce the error.

I assume this is related to the directory structure of the project which uses baseUrl to point up to the "lib" dir. Also, I was not able to reproduce this without Vue.

Environment

MacOS 10.15
Node 16

Metadata

Metadata

Assignees

Labels

kind: regressionSpecific type of bug -- past behavior that worked is now brokenproblem: removed issue templateOP removed the issue template without good causescope: integrationRelated to an integration, not necessarily to core (but could influence core)scope: vueRelated to integration with Vue (rollup-plugin-vue is long archived), not corescope: watch modeRelated to Rollup's watch modesolution: workaround availableThere is a workaround available for this issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions