Skip to content

feat: reload server when tsconfig.json is changed #5278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2025

Conversation

chenjiahan
Copy link
Member

Summary

The paths field in tsconfig.json affects the build result, so when the content of tsconfig.json changes, Rsbuild should reload the dev server to load the new tsconfig.json. This PR adds the paths of tsconfig.json files to dev.watchFiles to achieve this.

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 00:22
Copy link

netlify bot commented May 20, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 8adb09a
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/682be9e737b96400087cf9bd
😎 Deploy Preview https://deploy-preview-5278--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: 77 (🔴 down 9 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (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 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 enables the development server to automatically reload when the contents of tsconfig.json change, thereby ensuring that customizable paths defined within the tsconfig file apply to the build process. Key changes include:

  • Adding logic in initConfigs.ts to track and watch tsconfig.json file paths.
  • Renaming the variable from process to childProcess across multiple test files for clarity.
  • Introducing and updating test cases to validate the automatic reload behavior.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/provider/initConfigs.ts Adds tsconfigPaths tracking and updates the dev.watchFiles logic to trigger reload.
e2e/cases/plugin-api/plugin-on-exit-hook/index.test.ts Renames variable to childProcess to avoid conflicts when terminating processes.
e2e/cases/cli/reload-config/index.test.ts Updates variable name from process to childProcess for consistent process handling.
e2e/cases/cli/build-watch/index.test.ts Applies the renaming change for clarity in asynchronous process handling.
e2e/cases/cli/build-watch-restart/index.test.ts Similar renaming adjustment to improve clarity and consistency.
e2e/cases/alias/tsconfig-paths-reload/tsconfig.json Introduces a new tsconfig file used for testing tsconfig paths reload behavior.
e2e/cases/alias/tsconfig-paths-reload/src/index.ts Validates aliasing and DOM manipulation based on tsconfig changes.
e2e/cases/alias/tsconfig-paths-reload/src/foo/test.ts Provides a source module for alias testing.
e2e/cases/alias/tsconfig-paths-reload/src/bar/test.ts Provides an alternative source module for alias testing.
e2e/cases/alias/tsconfig-paths-reload/rsbuild.config.ts Updates build configuration to use the temporary tsconfig for testing reload logic.
e2e/cases/alias/tsconfig-paths-reload/index.test.ts Validates that the server reloads correctly when tsconfig changes.

@chenjiahan chenjiahan changed the title feat: reload server when tsconfig.json changed feat: reload server when tsconfig.json is changed May 20, 2025
@chenjiahan chenjiahan merged commit cfac9b4 into main May 20, 2025
12 checks passed
@chenjiahan chenjiahan deleted the reload_server_tsconfig_0520 branch May 20, 2025 02:41
@chenjiahan chenjiahan mentioned this pull request May 20, 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.

1 participant