-
Notifications
You must be signed in to change notification settings - Fork 29k
docs: polyfills usage in app router #80447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're adding quite a bit of detail to how to handle polyfills in app router but the pages router approach is fairly handwavy.
Presumably some of the strategies we're talking about in app router would apply to pages router (eg loading the module in the individual component) so perhaps we can split this out into things that are truly router specific? (Which I think would just be importing it into a root layout rather than the _app
component)
docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx
Outdated
Show resolved
Hide resolved
docs/01-app/03-api-reference/03-file-conventions/instrumentation-client.mdx
Outdated
Show resolved
Hide resolved
```ts filename="instrumentation-client.ts" switcher | ||
import './polyfills' | ||
``` | ||
|
||
```js filename="instrumentation-client.js" switcher | ||
import './polyfills' | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need switcher when the code is the same?
|
||
To include polyfills, you can import them into the [`instrumentation-client.js` file](/docs/app/api-reference/file-conventions/instrumentation-client). | ||
|
||
For other cases, you can create a client module that loads the polyfills you need. For example if you only want to polyfill client side: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph doesn't seem right here since it comes right before the instrumentation-client code snippet
Closes: https://linear.app/vercel/issue/DOC-4752/docs-polyfills-in-app-router
Fixes: #74730