ezolenko / rollup-plugin-typescript2

Rollup plugin for typescript with compiler errors.
MIT License
819 stars 71 forks source link

Watch mode has stale cache when using aliases #444

Closed nfxpnk closed 1 year ago

nfxpnk commented 1 year ago

Rollup Version

3.20.2

Operating System (or Browser)

Windows 10 latest

Node Version (if applicable)

18.13.0

Link To Reproduction

https://stackblitz.com/edit/rollup-repro-jz3iti?file=package.json OR https://github.com/nfxpnk/rollup-test

Expected Behaviour

  1. Run watch process: npm run watch
  2. Edit file test/flying-saucer/base/global/index.ts
  3. Watch process updates
  4. See builded file - dist-test/start.js
  5. New changes made in test/flying-saucer/base/global/index.ts present in builded file dist-test/start.js

Actual Behaviour

  1. Run watch process: npm run watch
  2. Edit file test/flying-saucer/base/global/index.ts
  3. Watch process updates
  4. See builded file - dist-test/start.js
  5. No changes in dist-test/start.js

If you will run just regular build with npm run build it works as expected.

Clean JS - not reproduceable - https://stackblitz.com/edit/rollup-repro-eghflu?file=rollup.config.js

ezolenko commented 1 year ago

Reproduces, likely happens because of imports resolved by @rollup/plugin-alias are not marked as dependencies for the importing file and cached version is returned. Solution would probably be running imports through rollup resolver and adding results as additional dependencies.

Works if I change all imports to relative paths and comment out alias.

Also works if cache is disabled with clean: true option on rpt2.

ezolenko commented 1 year ago

Cache is disabled during watch mode in 0.35.0 now