Skip to content

Conversation

@avivkeller
Copy link
Member

Closes #363
Ref: rolldown/rolldown#5364 (comment)

If we include the drive letters, the resolution will not duplicate imports.

Copilot AI review requested due to automatic review settings July 20, 2025 20:47
@avivkeller avivkeller requested a review from a team as a code owner July 20, 2025 20:47
@vercel
Copy link

vercel bot commented Jul 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
api-docs-tooling ✅ Ready (Inspect) Visit Preview Jul 20, 2025 8:53pm

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 a Windows-specific issue where drive letters were not being included in file paths, causing duplicate imports in the bundling process. The fix switches from POSIX-specific path handling to cross-platform path resolution and properly escapes backslashes for JavaScript string compatibility.

  • Switches from node:path/posix to node:path for cross-platform compatibility
  • Simplifies ROOT path calculation to use actual filesystem paths instead of POSIX-normalized paths
  • Adds backslash escaping for Windows paths in JavaScript import strings

Reviewed Changes

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

File Description
src/generators/web/utils/generate.mjs Updates path import and adds backslash escaping for CSS import
src/generators/web/constants.mjs Simplifies ROOT calculation and adds backslash escaping for all JSX component imports

@avivkeller avivkeller added the fast track This PR can land before the typical review time, with a :+1: from collaborators label Jul 21, 2025
@avivkeller
Copy link
Member Author

@nodejs/web-infra Fast-tracking, bug fix

@ovflowd ovflowd merged commit 7442b80 into main Jul 21, 2025
17 checks passed
@ovflowd ovflowd deleted the fix/win/paths branch July 21, 2025 15:36
) => {
// '\' characters shouldn't escape the next character,
// but rather be treated as slashes.
source = source.replaceAll('\\', '\\\\');
Copy link
Member

Choose a reason for hiding this comment

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

Is this related to PATH or something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Backslashes (Windows paths), when evaluated via Function, escape the next character, so we need to escape them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast track This PR can land before the typical review time, with a :+1: from collaborators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants