Skip to content

Watch mode cannot recover with typescript #258

Closed

Description

@karolis-sh
  • 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.

Activity

  1. danimoh commented on Mar 14, 2020

    @danimoh
    Contributor

    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?

  2. karolis-sh commented on Mar 14, 2020

    @karolis-sh
    Author

    @danimoh yes, it has no effect.

  3. Tylerian commented on Mar 19, 2020

    @Tylerian

    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
      })
    ]
    [...]
    
  4. karolis-sh commented on Mar 19, 2020

    @karolis-sh
    Author

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

  5. Tylerian commented on Mar 19, 2020

    @Tylerian

    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.

  6. Hashbrown777 commented on May 26, 2021

    @Hashbrown777

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions