Skip to content

feat: support dev.lazyCompilation.serverUrl use '<port>' placeholder#5035

Merged
chenjiahan merged 1 commit intoweb-infra-dev:mainfrom
gaoachao:feat/support-lazy-compilation-server-url
Apr 16, 2025
Merged

feat: support dev.lazyCompilation.serverUrl use '<port>' placeholder#5035
chenjiahan merged 1 commit intoweb-infra-dev:mainfrom
gaoachao:feat/support-lazy-compilation-server-url

Conversation

@gaoachao
Copy link
Contributor

@gaoachao gaoachao commented Apr 16, 2025

Summary

Although Rsbuild doesn't directly support setting dev.lazyCompilation with a custom serverUrl, we can leverage api.modifyRsbuildConfig to modify both assetPrefix and dev.lazyCompilation.serverUrl. However, there's an inconsistency: assetPrefix will find and replace <port> placeholders, while dev.lazyCompilation.serverUrl does not perform this replacement, leading to configuration mismatches.

dev: {
    assetPrefix: 'http://xxx:<port>/',
    lazyCompilation: {
      serverUrl: 'http://xxx:<port>/'
      // ...
    }
},

Therefore, in the lazyCompilationMiddleware, we need to check if is present in the URL, and if so, we need to replace it.

Related Links

Checklist

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

@CLAassistant
Copy link

CLAassistant commented Apr 16, 2025

CLA assistant check
All committers have signed the CLA.

@netlify
Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 34ef886
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/67ffa9825b4ee00008bc2cea
😎 Deploy Preview https://deploy-preview-5035--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: 81 (🟢 up 7 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 site configuration.

@gaoachao gaoachao force-pushed the feat/support-lazy-compilation-server-url branch from b1fd1fd to 34ef886 Compare April 16, 2025 12:58
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

LGTM👍 Thank you!

@chenjiahan chenjiahan merged commit ca7ce9c into web-infra-dev:main Apr 16, 2025
12 checks passed
@chenjiahan chenjiahan changed the title feat: support dev.lazyCompilation.serverUrl use <port> feat: support dev.lazyCompilation.serverUrl use '<port>' placeholder Apr 16, 2025
@gaoachao gaoachao deleted the feat/support-lazy-compilation-server-url branch April 16, 2025 13:52
@chenjiahan chenjiahan mentioned this pull request Apr 17, 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.

3 participants