next.js
df6aed34 - fix(Turbopack): Add better error messaging for when we can't determine Next.js root (#83918)

Commit
163 days ago
fix(Turbopack): Add better error messaging for when we can't determine Next.js root (#83918) ## Improve error message when Next.js package can't be found ### What? Enhances the `get_next_package` function to provide a more informative error message when the Next.js package cannot be found from the context directory. ### Why? When users encounter issues with Next.js package resolution, the previous generic error message "Next.js package not found" didn't provide enough context or guidance on how to fix the problem. The improved error message explains potential causes and solutions. ### How? - Updated the function to use Vc<FileSystemPath> for context_directory - Improved error handling with a detailed message that: - Explains the issue clearly - Shows the context directory path where resolution failed - Suggests setting `turbopack.root` in the Next.js config - Mentions potential issues with symlinks - Provides a link to documentation for more information ### How to Test To test this, 1. Modify `<projectRoot>/bench/basic-app/next.config.js` to ```js module.exports = { experimental: { serverMinification: true, }, turbopack: { root: __dirname, } } ``` 2. Run `pnpm build && pnpm swc-build-native` to ensure that you have the updated code 3. Run `pnpm next dev --turbo bench/basic-app` and ensure the error shows up exactly once 4. Run `pnpm next build --turbo bench/basic-app` and ensure the same error shows up exactly once --------- Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Co-authored-by: Luke Sandberg <lukeisandberg@gmail.com>
Author
Parents
Loading