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

Watch mode cannot recover with typescript #258

Closed
karolis-sh opened this issue Mar 12, 2020 · 6 comments
Closed

Watch mode cannot recover with typescript #258

karolis-sh opened this issue Mar 12, 2020 · 6 comments

Comments

@karolis-sh
Copy link

  • 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.

@danimoh
Copy link
Contributor

danimoh commented Mar 14, 2020

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?

@karolis-sh
Copy link
Author

@danimoh yes, it has no effect.

@Tylerian
Copy link

Tylerian commented Mar 19, 2020

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
  })
]
[...]

@karolis-sh
Copy link
Author

karolis-sh commented Mar 19, 2020

@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.

@Tylerian
Copy link

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.

@Hashbrown777
Copy link

For people who come across this because they want it on (/liked the default from before whenever #492 gets released) you can do this

//tsopts
{
    noEmitOnError : !process.env.ROLLUP_WATCH
}

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

No branches or pull requests

5 participants