Skip to content

fix(cli): hint preview for missing default entry#13834

Open
Sylar-W wants to merge 1 commit intoweb-infra-dev:mainfrom
Sylar-W:codex/rspack-serve-preview-hint
Open

fix(cli): hint preview for missing default entry#13834
Sylar-W wants to merge 1 commit intoweb-infra-dev:mainfrom
Sylar-W:codex/rspack-serve-preview-hint

Conversation

@Sylar-W
Copy link
Copy Markdown

@Sylar-W Sylar-W commented Apr 26, 2026

Summary

  • Warn when rspack serve runs without a config and the default ./src entry is missing.
  • Point users who are trying to serve build output toward rspack preview [dir].
  • Add a regression test for the missing default entry case.

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.ts
  • pnpm exec prettier --check packages/rspack-cli/src/cli.ts packages/rspack-cli/tests/serve/missing-default-entry/index.test.ts
  • pnpm exec rslint packages/rspack-cli/src/cli.ts
  • git diff --check

Checklist

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +76 to +77
['./src', './src.js', './src.json'].some((request) =>
fs.existsSync(path.resolve(context, request)),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant