Skip to content
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

Update with-polyfills example. #20996

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/with-polyfills/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Example app with polyfills
# With Polyfills

> ❗️ Warning: This example is not the suggested way to add polyfills and is known to cause issues with bundling. See [the browser support docs](https://nextjs.org/docs/basic-features/supported-browsers-features#custom-polyfills) for the correct way to load polyfills.
Next.js supports IE11 and all modern browsers (Edge, Firefox, Chrome, Safari, Opera, et al) with no required configuration. It also adds [some polyfills](https://nextjs.org/docs/basic-features/supported-browsers-features#polyfills) by default.

Next.js supports modern browsers and IE 11. It loads required polyfills automatically. If you need to add custom polyfills, you can follow this example.
If your own code or any external npm dependencies require features not supported by your target browsers, you need to add polyfills yourself.

In this case, you should add a top-level import for the specific polyfill you need in your Custom `<App>` or the individual component.

## Deploy your own

Expand Down
8 changes: 0 additions & 8 deletions examples/with-polyfills/client/polyfills.js

This file was deleted.

19 changes: 0 additions & 19 deletions examples/with-polyfills/next.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions examples/with-polyfills/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"dependencies": {
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0"
"react": "latest",
"react-dom": "latest"
},
"license": "MIT"
}
9 changes: 9 additions & 0 deletions examples/with-polyfills/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Add your polyfills here or at the component level.
// For example...
// import 'resize-observer-polyfill'

function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}

export default MyApp
2 changes: 0 additions & 2 deletions examples/with-polyfills/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
console.log('Inside the /index.js page')

export default function Home() {
return <div>Hello World</div>
}