Allow excluding manual chunks when using .generated
I am using the v5 .generated option, and I notice it doesn't allow excluding a chunk from compiling.
Parts of my project are already prebuilt, I just want to bundle this. I am using manual chunks to separating this code, it should be possible to exclude in the renderChunk phase using the chunk name. It works with rollup-plugin-terser too.
I realize this project is being moved to the plugins monorepo, will move the issue there when it's done.
Could u create a repro case for this? Im not that well-versed in those advanced possibilities of Rollup and it would be easier for me to understand this if I could look at your input files, config and generated code
This is an example setup: https://repl.it/repls/WigglySpiffyDatabase
I want to exclude big-library.js from babel and terser, since it's already es5 and minified. It's a huge library, it takes like 30sec to run through babel and terser :)
manualChunks allows telling rollup to keep it in a separate chunk, so that you can exclude it. Or so I thought, because unfortunately I see that the faceModuleId is not set for manual chunks, and the fileName is the minified filename. Terser's exclude logic doesn't work properly either because of this :(
It seems that we should use the .name field for this. See: https://github.com/rollup/rollup/issues/3497
Hm, filtering options have been on purpose not implemented for Babel output plugin by @lukastaegert: https://github.com/rollup/plugins/blob/2623f390c3385fcaf3a3072e8e6c0ec71f6ad114/packages/babel/src/index.js#L177-L182
Maybe he could shed some light if adding support for this is a good idea?
The idea was that those options are meant to describe source files in the file system, and if those options worked, they could create the expectation that it is possible to exclude on source module level, which is impossible. Moreover at the point where transformations are applied, actual file names are not even known. Therefore, reusing those options does not really make sense. One could match a regular expression against the name property of a chunk, though, but I think it would only work properly for manual chunks. An entry chunk might just be a facade after all. So maybe just enable listing names of manual chunks?
Also, not sure how one would want to run micromatch or picomatch on virtual files
@LarsDenBakker would you like to take a stab at implementing this through new options that would need to be used for manual chunks case?
I've got quite a lot of things pending currently, but I can definitely take a stab at this when I get the time :)