Skip to content

fix(module_federation_runtime_plugin): add support for root output dir#9620

Merged
ahabhgk merged 9 commits intomainfrom
mf-root-out-dir
Mar 19, 2025
Merged

fix(module_federation_runtime_plugin): add support for root output dir#9620
ahabhgk merged 9 commits intomainfrom
mf-root-out-dir

Conversation

@ScriptedAlchemy
Copy link
Contributor

@ScriptedAlchemy ScriptedAlchemy commented Mar 11, 2025

Summary

add support for rootOutputDir to locate chunk paths in node federation plugin

Webpack version:

   const outputName = this.compilation.getPath(
          jsModulePlugin.getChunkFilenameTemplate(
            this.chunk,
            this.compilation.outputOptions,
          ),
          { chunk: this.chunk, contentHashType: 'javascript' },
        );
        rootOutputDir = getUndoPath(
          outputName,
          this.compilation.outputOptions.path || '',
          false,
        );

in template:

  return template.asString([
    `if(!${federationGlobal}){`,
    template.indent([
      `${federationGlobal} = {`,
      template.indent([
        `initOptions: ${initOptionsStrWithoutShared},`,
        `chunkMatcher: function(chunkId) {return ${matcher}},`,
        `rootOutputDir: ${JSON.stringify(rootOutputDir || '')},`,
        `initialConsumes: undefined,`,
        'bundlerRuntimeOptions: {}',
      ]),
      '};',
    ]),
    '}',
  ]);

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Mar 11, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 48c6499
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67da2cc9fd2b3500085c651b

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Mar 11, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 11, 2025

CodSpeed Performance Report

Merging #9620 will not alter performance

Comparing mf-root-out-dir (48c6499) with main (d0439e5)

Summary

✅ 8 untouched benchmarks

@hardfist hardfist requested a review from ahabhgk March 18, 2025 01:56
Copy link
Contributor

@ahabhgk ahabhgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we need a test here just to avoid regression

@ScriptedAlchemy
Copy link
Contributor Author

Test added @ahabhgk

@ScriptedAlchemy ScriptedAlchemy requested a review from ahabhgk March 19, 2025 02:32
@ahabhgk ahabhgk merged commit e415b9d into main Mar 19, 2025
31 checks passed
@ahabhgk ahabhgk deleted the mf-root-out-dir branch March 19, 2025 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants