Skip to content

fix: should have js entry for importModule assets and rslib#12167

Merged
hardfist merged 2 commits intomainfrom
fix/asset-entry-js
Nov 12, 2025
Merged

fix: should have js entry for importModule assets and rslib#12167
hardfist merged 2 commits intomainfrom
fix/asset-entry-js

Conversation

@JSerFeng
Copy link
Copy Markdown
Contributor

Summary

Should have a js module when using importModule point to assets, otherwise it will get empty result by importModule. RslibPlugin also needs this js module to implements bundleless features.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 12, 2025 07:13
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 12, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit ca96c69
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/69144134c10a2a0008919405

@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Nov 12, 2025
Copy link
Copy Markdown
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 fixes an issue where asset entries and loader importModule calls were not generating the necessary JavaScript entry files. The fix ensures that when using importModule to point to assets, or when using RslibPlugin with asset entries, a proper JavaScript module is generated instead of an empty result.

Key changes:

  • Modified the AssetParserAndGenerator to include JavaScript source type for loader imports
  • Created a wrapper RslibAssetParserAndGenerator to customize source types for asset entry resources
  • Changed the NormalModuleFactoryParser hook signature to use Box<dyn ParserAndGenerator> instead of raw reference

Reviewed Changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/rspack_plugin_asset/src/lib.rs Added logic to include JavaScript source type for LoaderImport dependencies and made AssetParserAndGenerator Clone-able
crates/rspack_plugin_rslib/src/asset.rs New wrapper around AssetParserAndGenerator that returns JavaScript+Asset source types for entry resources
crates/rspack_plugin_rslib/src/plugin.rs Integrated RslibAssetParserAndGenerator for asset parsers
crates/rspack_core/src/normal_module_factory.rs Changed parser hook parameter from mutable reference to Box
tests/rspack-test/configCases/loader-import-module/assets/ Added test case for loader importModule with assets
tests/rspack-test/configCases/rslib/asset-entry/ Added test case for rslib with asset entry
Multiple plugin files Updated to match new parser hook signature
crates/rspack_plugin_rslib/Cargo.toml Added dependencies needed for asset wrapper

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 12, 2025

📦 Binary Size-limit

Comparing ca96c69 to refactor: move build_chunk_graph into compilation (#12162) by hardfist

❌ Size increased by 5.38KB from 48.09MB to 48.10MB (⬆️0.01%)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JSerFeng JSerFeng enabled auto-merge (squash) November 12, 2025 08:13
@hardfist hardfist disabled auto-merge November 12, 2025 09:25
@hardfist hardfist merged commit 39a2b1f into main Nov 12, 2025
64 of 67 checks passed
@hardfist hardfist deleted the fix/asset-entry-js branch November 12, 2025 09:25
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 12, 2025

CodSpeed Performance Report

Merging #12167 will not alter performance

Comparing fix/asset-entry-js (ca96c69) with main (0c06124)

Summary

✅ 17 untouched

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) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants