turbo icon indicating copy to clipboard operation
turbo copied to clipboard

[turbopack] Emit error issue when missing entry files (src/index.js, pages/, app/)

Open wbinnssmith opened this issue 3 years ago • 3 comments

Currently missing the src/index.js entry results in an empty page, with no feedback in the terminal about the missing entry file. This can lead to confusion if running turbopack from the wrong cwd.

This:

  • Introduces OptionContentSourceVc, which signals this case. A custom Error type for missing entries may be an opportunity for refinement, but this is in line with @sokra's suggestion below. When all (src, pages, app) main content sources return a wrapped None, this issue is emitted.
  • Publicizes and emits a NextAppIssue, which was previously only used for one other issue in next-core.

It now causes the following message to be written to the terminal:

error - [next app] path/to/testapp/
  An issue occurred while preparing your Next.js app
  Missing Next.js entry file(s): src/index.js, pages/*.js, and app/**/page.js are missing.

This still results in an empty page however. We should work on surfacing issues that occur before an HMR connection is established.

Test Plan: Removed src/index.js, pages/*.js, and app/**/page.js in a test app and confirmed the above message was logged to the terminal.

wbinnssmith avatar Oct 26 '22 23:10 wbinnssmith

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-native-web 🔄 Building (Inspect) Nov 17, 2022 at 8:36PM (UTC)
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Nov 17, 2022 at 8:36PM (UTC)
5 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Nov 17, 2022 at 8:36PM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Nov 17, 2022 at 8:36PM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Nov 17, 2022 at 8:36PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Nov 17, 2022 at 8:36PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Nov 17, 2022 at 8:36PM (UTC)

vercel[bot] avatar Oct 26 '22 23:10 vercel[bot]

From @sokra: this should only happen if we're missing a src/index.js, pages, and app directory (the entries for each ContentSource). Consider returning an Result<Option<ContentSourceVc>> from each, and if all are missing, emit an issue that covers the case where all are missing.

wbinnssmith avatar Oct 26 '22 23:10 wbinnssmith

:warning: CI failed :warning:

The following steps have failed in CI:

  • Rust tests
  • Rust benchmark tests

See workflow summary for details

github-actions[bot] avatar Nov 17 '22 22:11 github-actions[bot]