Skip to content

Conversation

@fi3ework
Copy link
Member

@fi3ework fi3ework commented Nov 12, 2025

Summary

fix #316.

in this PR:

depends on depends on web-infra-dev/rspack#12168, the native Rslib plugin has handled hashbang and react directives.

with advancedEsm

no entry dedicated loader anymore, advancedEsm can handle "the issue of a module acting as both an entry module and a non-entry module is that the module graph can affect each other".

without advancedEsm

still using a dedicated loader, but only an empty loader to make the doppelganger. the loader will not handle hashbang and react directives anymore (already handled in native plugin).

Related Links

Checklist

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

@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit 6649b6a
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/691d833e2b4f8a00088ac13a
😎 Deploy Preview https://deploy-preview-1331--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fi3ework fi3ework force-pushed the hashbang branch 6 times, most recently from 3b2dc19 to 1b8e9a0 Compare November 19, 2025 06:28
@fi3ework fi3ework marked this pull request as ready for review November 19, 2025 06:41
Copilot AI review requested due to automatic review settings November 19, 2025 06:41
@fi3ework
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot finished reviewing on behalf of fi3ework November 19, 2025 06:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors hashbang (#!) and React directive handling by delegating them to Rspack's native plugin instead of handling them in the Rslib loader/plugin. The change simplifies the codebase and leverages native functionality.

Key Changes

  • Removed hashbang and React directive handling logic from EntryChunkPlugin and entryModuleLoader
  • Added directives: false to minify configuration to preserve directive prologues
  • Made entry module loader conditional based on advancedEsm flag - when enabled, no loader is needed

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/plugins/entryModuleLoader.ts Simplified to empty pass-through loader for creating entry module doppelganger
packages/core/src/plugins/EntryChunkPlugin.ts Removed shebang/directive handling logic and related state tracking; added useLoader parameter
packages/core/src/constant.ts Removed unused shebang and React directive constants
packages/core/src/config.ts Added directives: false to minify config and conditional loader usage based on advancedEsm
tests/integration/directive/react/bundleless/rslib.config.ts Added minify configuration with comment explaining directives: false option
tests/integration/directive/index.test.ts Updated test expectations to match native plugin output format (double quotes, preserved directives)
tests/integration/entry/index.test.ts Updated snapshots for new chunk organization with advancedEsm
tests/integration/shims/index.test.ts Made regex pattern more flexible to handle dynamic chunk IDs
packages/core/tests/config.test.ts Updated test snapshot to include directives: false
packages/core/tests/snapshots/config.test.ts.snap Updated all snapshots to reflect removed directive handling and added minify option
pnpm-lock.yaml Bumped @rspack/plugin-react-refresh from 1.5.2 to 1.5.3
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Timeless0911 Timeless0911 merged commit ee653c3 into main Nov 19, 2025
16 checks passed
@Timeless0911 Timeless0911 deleted the hashbang branch November 19, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Multiple entry files packaged esm file import error undefind

3 participants