Skip to content

fix(core): normalize paths for include/exclude rules on Windows#6380

Merged
chenjiahan merged 2 commits intomainfrom
fix_source_include_1018
Oct 18, 2025
Merged

fix(core): normalize paths for include/exclude rules on Windows#6380
chenjiahan merged 2 commits intomainfrom
fix_source_include_1018

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Oct 18, 2025

Summary

On Windows, require.resolve returns paths with forward slashes (when using jiti) which can cause issues with source.include rules. This change adds path normalization to ensure consistent path handling across platforms.

Related Links

resolve #6372

Checklist

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

Copilot AI review requested due to automatic review settings October 18, 2025 08:48
@netlify
Copy link

netlify bot commented Oct 18, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 782d633
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68f35fef680a770008e0ac66
😎 Deploy Preview https://deploy-preview-6380--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 68 (🔴 down 5 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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

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 path normalization issues on Windows when using source.include rules with require.resolve, which returns paths with forward slashes that may not match the expected format for path matching.

Key Changes:

  • Adds an end-to-end test to verify that source.include works correctly with paths obtained from require.resolve
  • The test creates a mock dependency and ensures it's properly included and processed through the build pipeline

Reviewed Changes

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

File Description
e2e/cases/source/source-include-dependency/src/index.js Adds test source file that imports from the mock 'test' package
e2e/cases/source/source-include-dependency/rsbuild.config.ts Configures the test with source.include using dirname(require.resolve()) pattern
e2e/cases/source/source-include-dependency/index.test.ts Implements the e2e test that verifies syntax checking works on included dependencies

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

@chenjiahan chenjiahan merged commit ea7ecbf into main Oct 18, 2025
11 checks passed
@chenjiahan chenjiahan deleted the fix_source_include_1018 branch October 18, 2025 09:53
@chenjiahan chenjiahan mentioned this pull request Oct 30, 2025
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]: source.include with path.resolve fails on Windows but works on macOS

1 participant