Using rollup in watch mode, the TS compiler shouldn't break the watcher with default options.
Now you need to add typescript({ noEmitOnError: false }) in rollup.config.js for the watcher to work properly.
https://github.com/rollup/plugins/tree/master/packages/typescript#noemitonerror the noEmitOnError default should be false, so that rollup usage would be more intuitive.
Agreed, the program should also obey noEmitOnError if specified in the tsconfig.
@NotWoods I'm doing some housekeeping on old issues. Should we take this one up?
I'll take this on.
I think there are multiple things we can do here:
noEmitOnError. This is the action currently suggestednoEmitOnError is necessary to make watch mode work, then the plugin should print a warning when that flag is encountered in watch mode or it should be in screaming huge letters on the README along with an explanation as to why. It's not mentioned at all right nownoEmitOnError. It's not clear to me why noEmitOnError: true breaks watch mode and if that's necessary and expectednoEmitOnError is expected behaviour for most people using the plugin outside of watch mode. They expect Rollup to fail rather than warn when type errors are encountered. We also mention that we default to true in the README. I'll change the default to false when in watch mode.
I tested noEmitOnError: false with standard building (i.e. without watching) and it still behaves as I'd expect and errors instead of warning. I'm not quite sure why we need to override what the user has in tsconfig.json for the standard case. Perhaps that behavior is different depending on the type of error? I had triggered it by just entering extra characters to create invalid syntax:
import App from './App.svelte';
const app = new App({
target: document.body,
props: {
name: 'world'
}asdsdf
});
export default app;
I think the behavior you suggested sounds reasonable enough though and will avoid the vast majority of users from hitting this issue
I see that we also override the defaults for module and skipLibCheck. I did not expect that would be happening and the behavior isn't documented. Would it be okay to remove all the defaults overrides or is there a reason the others are required? (It would obviously be a breaking change requiring a major version bump)
PR submitted for this in https://github.com/rollup/plugins/pull/544
Aye I think we'll close this one.
Most helpful comment
I'll take this on.