Repository navigation
fix: escape dependency paths in CJS and UMD output - #11076
Conversation
f472b2b to
56adeaf
Compare
56adeaf to
d16323a
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The escaping changes consistently use the established serializer and include comprehensive behavioral coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Escapes dependency paths correctly in generated CJS and UMD output.
Changes:
- Serialize dependency paths as complete JavaScript string literals.
- Cover external imports, star re-exports, and shared chunks with behavioral tests.
- Update the UMD output assertion for double-quoted dependencies.
| File | Description |
|---|---|
crates/rolldown/src/ecmascript/format/cjs.rs |
Escapes CJS dependency paths. |
crates/rolldown/src/ecmascript/format/umd.rs |
Escapes AMD and CJS UMD dependencies. |
crates/rolldown/src/utils/chunk/render_chunk_exports.rs |
Escapes star re-export paths. |
packages/rolldown/tests/behaviors/dependency-path-escaping.test.ts |
Adds path-preservation coverage. |
packages/rolldown/tests/fixtures/builtin-plugin/esm-external-require-plugin/umd-output/_config.ts |
Updates expected UMD syntax. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merging this PR will not alter performance
Comparing Footnotes
|
3905e6d
into
fix/export-rendering-diagnostics
Dependency paths containing quotes or backslashes can generate invalid JavaScript or load a different module in CJS and UMD output. Preserve the exact path in
require()calls and UMD AMD dependency arrays.For a mapped path containing a literal backslash followed by
n, the generated call changes from:to:
Serialize each dependency path as a complete string literal using the same escaping utility as ESM imports. This covers external imports, external star re-exports, and references to shared CJS chunks.