9e86fd1d58
When in the pages dir, the compiler errors where the `"use client"` directive is used incorrectly should tell the user how to fix the error - not just say: ``` You have tried to use the "use client" directive which is not supported in the pages/ directory. ``` This removes those cases and instead displays the same error as in the app dir. However, if you try to import something that requires it to be a Server Component, the pages error is still: ``` That only works in a Server Component which is not supported in the pages/ directory. ```` ref: [slack](https://vercel.slack.com/archives/C035J346QQL/p1676983422753729) ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) |
||
---|---|---|
.. | ||
__snapshots__ | ||
helpers.ts | ||
ReactRefresh.test.ts | ||
ReactRefreshLogBox-app-doc.test.ts | ||
ReactRefreshLogBox-builtins.test.ts | ||
ReactRefreshLogBox-scss.test.ts | ||
ReactRefreshLogBox.test.ts | ||
ReactRefreshLogBoxMisc.test.ts | ||
ReactRefreshModule.test.ts | ||
ReactRefreshRegression.test.ts | ||
ReactRefreshRequire.test.ts | ||
server-component-compiler-errors-in-pages.test.ts |