Closed imtheaman closed 4 months ago
So, most directives work at the top of files, and they are scoped to that file. If you bundle your code into one file, and some of those files are for example React client components, should this plugin:
A) Include the "use client"
at the top of the bundle making all components client components?
B) Ignore it and make no components client components?
Another approach could be to split the bundle into two, so everything with "use client" ends up in one and everything else ends up in the other, but that's out of scope for this plugin which aims to be agnostic around which directives are preserved. The idea with preserveModules
is that it delays bundling to the consuming application, meaning, it keeps all files intact and lets whoever uses your library deal with composing them together into bundles which makes sense.
Does that explanation make sense?
I don' think it's a good idea to set
output.preserveModules
option to true, ain' there a workaround to this? my dist directory looks like this