Skip to content
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

fix(cli): load @rspack/dev-server on demand #6370

Merged
merged 1 commit into from May 7, 2024
Merged

fix(cli): load @rspack/dev-server on demand #6370

merged 1 commit into from May 7, 2024

Conversation

xc2
Copy link
Collaborator

@xc2 xc2 commented Apr 25, 2024

Summary

fixes #6359

stop loading @rspack/dev-server on rspack build to prevent process.env.WEBPACK_SERVE being set to true on cli's build mode.

Example

// rspack.config.js
console.log(process.env.WEBPACK_SERVE);
module.exports = {
  // ...
};
command BEFORE AFTER
rspack build "true" undefined
rspack serve "true" "true"

Performance

requiring @rspack/dev-server will resolve and load 433 files, so this change will also make the cli bootstrap faster on build mode.

When testing on mac studio m2 max:

  • ~100ms faster (io preheated)

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required) - no eed

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Apr 25, 2024
Copy link

netlify bot commented Apr 25, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 436547c
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6630d32e7ec9c40008355344

@xc2 xc2 changed the title fix(cli): load @rspack/dev-server on demand fix(cli): load @rspack/dev-server on demand - may be breaking change Apr 25, 2024
@xc2 xc2 force-pushed the fix/6359 branch 2 times, most recently from e628b15 to 3b2fc0a Compare April 28, 2024 11:09
@xc2 xc2 requested review from JSerFeng and hardfist April 29, 2024 02:34
@xc2 xc2 changed the title fix(cli): load @rspack/dev-server on demand - may be breaking change fix(cli): load @rspack/dev-server on demand Apr 29, 2024
@JSerFeng
Copy link
Collaborator

JSerFeng commented May 7, 2024

Thanks !

@xc2 xc2 merged commit 76f4c16 into main May 7, 2024
29 checks passed
@xc2 xc2 deleted the fix/6359 branch May 7, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: WEBPACK_SERVE environment variable is set when running rspack builds
2 participants