rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Feature]: Configurable prefix for module ids, chunk ids

Open vlevshits opened this issue 1 year ago • 2 comments

What problem does this feature solve?

In case if we are using RSBuild/RSPack to build microfrontend application with async modules we can get issues when the same id gets assigned to chunks/modules and in result application starts using chunks/modules from a different app.

It would be nice to have a way to configure prefix for ids within the config or allow this to be done via plugins

What does the proposed API of configuration look like?

It seems to be relatively easy to have configuration like below for existing plugins to allow to have prefix for module names

rspack: {

optimization: {

moduleIds: 'deterministic'
, moduleIdPrefix: 'my-app-01'
, chunkIds: 'deterministic'
, chunkIdPrefix: 'my-app-01'
, }, 
},

Another options is to allow plugins with similar functionality https://github.com/porsche-design-system/porsche-design-system/blob/42d4773819327e73885cee7af35aa4c4a70dbd13/packages/components-js/projects/components-wrapper/CustomNamedChunkIdsPlugin.js#L18

vlevshits avatar Mar 05 '24 09:03 vlevshits

In rspack, the chunk graph is implemented on the Rust side, and transferring it to the JavaScript side incurs a high cost. This feature may be considered when supporting Rust-side plugins in the future.

LingyuCoder avatar Apr 23 '24 06:04 LingyuCoder

In rspack, the chunk graph is implemented on the Rust side, and transferring it to the JavaScript side incurs a high cost. This feature may be considered when supporting Rust-side plugins in the future.

In case if we are not talking about proper plugin, can we have something more lightweight? Let's say a prefix config for existing rust middleware to generate id? Basically the only thing we need is to add constant prefix for ids

vlevshits avatar Apr 23 '24 08:04 vlevshits

In rspack, the chunk graph is implemented on the Rust side, and transferring it to the JavaScript side incurs a high cost. This feature may be considered when supporting Rust-side plugins in the future.

In case if we are not talking about proper plugin, can we have something more lightweight? Let's say a prefix config for existing rust middleware to generate id? Basically the only thing we need is to add constant prefix for ids

vlevshits avatar Apr 23 '24 08:04 vlevshits

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Jun 22 '24 08:06 stale[bot]

not planned yet, may support js api to modify this in the future. we'll revisit this issue when we think we have enough api to support this.

hardfist avatar Sep 05 '24 15:09 hardfist