Skip to content

Conversation

@Timeless0911
Copy link
Contributor

Summary

import.meta.url shims should work correctly in async chunks since chunk.name may be undefined if no magic comments set.

Related Links

close: #1277

Checklist

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

Copilot AI review requested due to automatic review settings October 21, 2025 08:09
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 fixes the generation of import.meta.url shims in CommonJS async chunks by ensuring the shim injection tracking occurs before checking if the chunk name is defined, preventing async chunks without magic comments from being skipped.

  • Moved shimsInjectedAssets.add(filename) before the early return when chunk.name is undefined
  • Added test coverage for import.meta.url usage in dynamically imported modules
  • Verified that the shim is correctly generated in async chunks

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/plugins/EntryChunkPlugin.ts Moved shim tracking before name check to handle async chunks
tests/integration/shims/cjs/src/index.ts Added dynamic import test case
tests/integration/shims/cjs/src/dynamic.ts New file testing import.meta.url in async chunk
tests/integration/shims/index.test.ts Added test assertions for async chunk shim generation
tests/integration/shims/cjs/rslib.config.ts Formatting changes only

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Timeless0911 Timeless0911 merged commit 9d1e9ab into main Oct 21, 2025
18 checks passed
@Timeless0911 Timeless0911 deleted the fix/async-chunk-cks-cshim branch October 21, 2025 08:17
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]: dynamic import 'open' package, no __rslib_import_meta_url api function in artifact reduce the error.

3 participants