Enable watcher in code-splitting mode - #2035
Conversation
3052d90 to
548081b
Compare
|
@guybedford @lukastaegert I believe this should be ready for a 👀 |
guybedford
left a comment
There was a problem hiding this comment.
Amazing work, thanks so much for working on this, these sorts of contributions remind me why open source is worthwhile :)
| } | ||
| } else { | ||
| const chunk = (<OutputChunk>result); | ||
| this.cache = { chunks: { [this.inputOptions.entry]: chunk } }; |
There was a problem hiding this comment.
If the cache consists of chunks in both cases, do we still need the this.cache.modules check in https://github.com/rollup/rollup/pull/2035/files#diff-7c1e6304262c178e7fe268b62060e26bR85 ?
There was a problem hiding this comment.
Ah, good question. I should have explained this in the code.
Task#cache is typed as {chunks: { [name]: { modules } } } even in the single-bundle case just to keep this code slightly simpler.
However, for the type of InputOptions.cache, which is part of the public JS API, I went with { modules } | {chunks: { [name]: { modules } } } so that this wouldn't be a breaking change (and because I think the existing cache option, wherein a developer can simply pass the previous bundle result back in as cache:, seems to make sense).
There was a problem hiding this comment.
Task#cache is typed as {chunks: { [name]: { modules } } } even in the single-bundle case just to keep this code slightly simpler.
On second thought, I think it's probably clearer and easier to understand in the future if we just keep Task#cache typed identically to InputOptions#cache. I'll push that change.
|
@guybedford ah, whoops I didn't realize I'd gotten behind master. I'll rebase & resolve now. |
3403d98 to
07da0b0
Compare
|
Updated |
lukastaegert
left a comment
There was a problem hiding this comment.
Really works like a charm! I have no concerns with merging this.
|
On another note: I think for the future we should work towards re-implementing the non-code-splitting case to be handled as a single chunk code-splitting case to get rid of all the duplicity we currently have in some places. Once we do that, we will be able to again have only one type of cache. |
|
@guybedford @lukastaegert anything else you need here before this can be merged? |
Closes #1950
rollup.rollup()to reflect code-splitting output type.