Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide updated cache when an error is thrown #3386

Closed
lukastaegert opened this issue Feb 12, 2020 · 0 comments · Fixed by #3388
Closed

Provide updated cache when an error is thrown #3386

lukastaegert opened this issue Feb 12, 2020 · 0 comments · Fixed by #3388

Comments

@lukastaegert
Copy link
Member

lukastaegert commented Feb 12, 2020

Expected Behavior

  1. Run npm install; npm start.
    Rollup starts in watch mode and compiles successfully

  2. Change app.ts to

    export function example(): number {
      return 42;
    }

    A type error is shown

  3. Change app.ts back to its original state
    Rollup recompiles and the build is working again.

Actual Behavior

  1. Change app.ts back to its original state
    Rollup recompiles but reuses a cached version of app.ts and displays the type error again.

This has been taken from rollup/plugins#186

The issue lies likely in how caching is handled in watch mode. The cache is only updated when a build completes successfully. When a module errors however, it should be evicted from the cache so that subsequent builds run it again. To solve this, maybe rollup can attach the cache to errors (similar to how watchFiles are added at the moment). Other options could be explored as well.

I do not think it is prudent to evict the entire cache on errors as this will mean a rebuild after an error will be unnecessarily slow while the user might be interested in a quick fix.

Instead of evicting erroring modules, we could also provide plugins with the option to manually evict modules from the cache. Still, the updated cache would need to be passed down to the caller of rollup.watch somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant