Plugins: Watch mode cannot recover with typescript

Created on 12 Mar 2020  Ā·  5Comments  Ā·  Source: rollup/plugins

  • Rollup Plugin Name: @rollup/plugin-typescript
  • Rollup Plugin Version: 4.0.0
  • Rollup Version: 2.0.3
  • Operating System (or Browser): mac
  • Node Version: 10.15.0

Running rollup in watch mode with typescript plugin if the typescript code is invalid the watcher breaks and exits with exit code 1. This make it impossible to re-build the code on code changes - you need to re-start the command every time.

(noEmitOnError ts compiler option doesn't help here)

How Do We Reproduce?

https://github.com/karolis-sh/issue-rollup-typescript-1 (has a readme file)

Expected Behavior

Watch mode should work just like using js files.

Actual Behavior

Watch mode exits with exit code 1.

c¹ ā‹… discussion šŸ”Œ plugin-typescript

Most helpful comment

@Tylerian yeah, you're right typescript({ noEmitOnError: false }) makes the plugin usable in development mode.

Though I feel this should be enabled by default in watch mode, otherwise it's rather unintuitive.

Anyway, thanks for the help - it was getting pretty annoying to always restart my watchers.

All 5 comments

Currently you have noEmitOnError: true in your project setup. Have you tried noEmitOnError: false to let typescript emit stuff even on errors instead of failing?

@danimoh yes, it has no effect.

As stated on plugin readme, it ignores the noEmitOnError property defined in tsconfig.json.
The only way to override it is adding noEmitOnError: false at plugin setup. See example below:

/* rollup.config.js */
[...]
plugins: [
  typescript({
    noEmitOnError: false
  })
]
[...]

@Tylerian yeah, you're right typescript({ noEmitOnError: false }) makes the plugin usable in development mode.

Though I feel this should be enabled by default in watch mode, otherwise it's rather unintuitive.

Anyway, thanks for the help - it was getting pretty annoying to always restart my watchers.

Though I feel this should be enabled by default in watch mode, otherwise it's rather unintuitive.

Yeah, I agree with that too. Perhaps you can open a new Feature Request so the maintainers can discuss this with you and hopefully agree to add it to the plugin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tronil picture Tronil  Ā·  6Comments

BitYoungjae picture BitYoungjae  Ā·  5Comments

AaronMcCloskey picture AaronMcCloskey  Ā·  6Comments

raduchiriac picture raduchiriac  Ā·  6Comments

1o1w1 picture 1o1w1  Ā·  4Comments