fix(cli): hint preview for missing default entry#13834
fix(cli): hint preview for missing default entry#13834Sylar-W wants to merge 1 commit intoweb-infra-dev:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f56affcae9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ['./src', './src.js', './src.json'].some((request) => | ||
| fs.existsSync(path.resolve(context, request)), |
There was a problem hiding this comment.
Detect resolvable default entry instead of filesystem presence
The new hasDefaultEntry helper only checks whether ./src, ./src.js, or ./src.json exists on disk, but rspack still fails when ./src exists as a directory without a resolvable default module (for example, an empty src/ folder or a src/ folder containing only main.ts). In those cases rspack serve still errors on resolving ./src, yet this warning is suppressed, so the commit’s new guidance is skipped for a real missing-default-entry case.
Useful? React with 👍 / 👎.
Summary
rspack serveruns without a config and the default./srcentry is missing.rspack preview [dir].Related links
Refs #13799
Test Plan
NAPI_RS_NATIVE_LIBRARY_PATH="$PWD/node_modules/.pnpm/@rspack+binding-darwin-arm64@2.0.0/node_modules/@rspack/binding-darwin-arm64/rspack.darwin-arm64.node" pnpm --filter @rspack/cli test -- tests/serve/missing-default-entry/index.test.tspnpm exec prettier --check packages/rspack-cli/src/cli.ts packages/rspack-cli/tests/serve/missing-default-entry/index.test.tspnpm exec rslint packages/rspack-cli/src/cli.tsgit diff --checkChecklist