rslib icon indicating copy to clipboard operation
rslib copied to clipboard

[Feature]: Support clean distPath of DTS before build

Open Timeless0911 opened this issue 1 year ago • 4 comments

What problem does this feature solve?

For js outputs, Rsbuild will automatically clean distPath, see more details https://rsbuild.dev/config/output/clean-dist-path#outputcleandistpath

And for DTS outputs, we should also support to control the behaviour of clean DTS distPath after below code:

https://github.com/web-infra-dev/rslib/blob/4b5f674789059bea3456e1105cb3cf9b051912d7/packages/plugin-dts/src/index.ts#L63

The default value of clean should directly read from output.cleanDistPath

  • if it is false value, do not remove DTS distPath
  • otherwise, just remove DTS distPath

Timeless0911 avatar Aug 29 '24 06:08 Timeless0911

Do we need a new option? How about always reading output.cleanDistPath.

chenjiahan avatar Aug 29 '24 06:08 chenjiahan

Do we need a new option? How about always reading output.cleanDistPath.

That seems better.

Timeless0911 avatar Aug 29 '24 06:08 Timeless0911

As a Rsbuild plugin, the DTS plugin could add a new config field, and defaults to Rsbuild's output.cleanDistPath while could be altered by user. In Rslib, we don't need to expose the config at the moment.

fi3ework avatar Aug 29 '24 06:08 fi3ework

As a Rsbuild plugin, the DTS plugin could add a new config field, and defaults to Rsbuild's output.cleanDistPath while could be altered by user. In Rslib, we don't need to expose the config at the moment.

Rsbuild plugin can directly read output.cleanDistPath, seems no need to add an extra options for rsbuild-plugin-dts

Timeless0911 avatar Aug 29 '24 07:08 Timeless0911