Skip to content

refactor: improve render external module for module output#10080

Merged
JSerFeng merged 3 commits intomainfrom
feat/improve-external-render
Apr 21, 2025
Merged

refactor: improve render external module for module output#10080
JSerFeng merged 3 commits intomainfrom
feat/improve-external-render

Conversation

@JSerFeng
Copy link
Copy Markdown
Contributor

Summary

Improve the rendering of ExternalModule.

Before:

import * as __WEBPACK_EXTERNALS_foo__ from 'foo'

__WEBPACK_EXTERNALS_foo__.value

This PR:

import { value } from 'foo'

value

Design detail

Add a new concatenation hook named concatenation_info, this hook is used to let module prepare some data in the correct topological order, for example, moduleA, moduleB can use this hook to add their globally used names.

ExternalModule has global names because they will insert some import statements through InitFragment.

// a.js
import { a } from 'foo';
// b.js
import { a } from 'bar';

Tap this hook, and insert the a to the globally used names, so we can deconflict the conflict symbol name.

Checklist

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

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 18, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit f0522b7
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6805cf9cdb141b000897680f

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 18, 2025
@JSerFeng JSerFeng force-pushed the feat/improve-external-render branch from 5ab41fa to 9d38524 Compare April 18, 2025 09:20
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 18, 2025

CodSpeed Performance Report

Merging #10080 will not alter performance

Comparing feat/improve-external-render (f0522b7) with main (b854e57)

Summary

✅ 11 untouched benchmarks

@JSerFeng JSerFeng force-pushed the feat/improve-external-render branch from 9d38524 to 8a14572 Compare April 18, 2025 10:11
@JSerFeng JSerFeng requested a review from fi3ework April 18, 2025 10:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 21, 2025

📝 Ecosystem CI detail: Open

suite result
rspress ❌ failure
rslib ❌ failure
rsdoctor ❌ failure
modernjs ❌ failure
examples ✅ success
rsbuild ✅ success
plugin ✅ success
lynx-stack ❌ failure
devserver ❌ failure
nuxt ✅ success

@fi3ework
Copy link
Copy Markdown
Member

I manually checked test case of Rslib in eco-ci, changes are expected, the output code is much neater. 👍

@JSerFeng JSerFeng merged commit 31f99d5 into main Apr 21, 2025
27 checks passed
@JSerFeng JSerFeng deleted the feat/improve-external-render branch April 21, 2025 06:46
JSerFeng added a commit that referenced this pull request Apr 22, 2025
chenjiahan pushed a commit that referenced this pull request Apr 22, 2025
…10126)

Revert "refactor: improve render external module for module output (#10080)"

This reverts commit 31f99d5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants