Skip to content

Commit

Permalink
Merge branch 'canary' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Sep 12, 2020
2 parents ae7cc20 + 71c5ab6 commit 12f9fff
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
11 changes: 10 additions & 1 deletion docs/advanced-features/customizing-babel-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ Here's an example `.babelrc` file:

You can [take a look at this file](https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/preset.ts) to learn about the presets included by `next/babel`.

To configure these presets/plugins, **do not** add them to `presets` or `plugins` in your custom `.babelrc`. Instead, configure them on the `next/babel` preset, like so:
To add presets/plugins **without configuring them**, you can do it this way:

```json
{
"presets": ["next/babel"],
"plugins": ["@babel/plugin-proposal-do-expressions"]
}
```

To add presets/plugins **with custom configuration**, do it on the `next/babel` preset like so:

```json
{
Expand Down
11 changes: 5 additions & 6 deletions docs/advanced-features/measuring-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,12 @@ export function reportWebVitals(metric) {
> export function reportWebVitals({ id, name, label, value }) {
> // Use `window.gtag` if you initialized Google Analytics as this example:
> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js
> window.gtag('send', 'event', {
> eventCategory:
> window.gtag('event', name, {
> event_category:
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
> eventAction: name,
> eventValue: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers
> eventLabel: id, // id unique to current page load
> nonInteraction: true, // avoids affecting bounce rate.
> value: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers
> event_label: id, // id unique to current page load
> non_interaction: true, // avoids affecting bounce rate.
> })
> }
> ```
Expand Down
2 changes: 1 addition & 1 deletion examples/with-msw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"dependencies": {
"msw": "^0.20.4",
"msw": "^0.21.0",
"next": "latest",
"react": "^16.13.1",
"react-dom": "^16.13.1"
Expand Down
9 changes: 8 additions & 1 deletion examples/with-msw/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/* eslint-disable */
/* tslint:disable */

const INTEGRITY_CHECKSUM = 'ca2c3cd7453d8c614e2c19db63ede1a1'
const INTEGRITY_CHECKSUM = 'd1e0e502f550d40a34bee90822e4bf98'
const bypassHeaderName = 'x-msw-bypass'

let clients = {}
Expand All @@ -27,6 +27,13 @@ self.addEventListener('message', async function (event) {
const allClientIds = allClients.map((client) => client.id)

switch (event.data) {
case 'KEEPALIVE_REQUEST': {
sendToClient(client, {
type: 'KEEPALIVE_RESPONSE',
})
break
}

case 'INTEGRITY_CHECK_REQUEST': {
sendToClient(client, {
type: 'INTEGRITY_CHECK_RESPONSE',
Expand Down

0 comments on commit 12f9fff

Please sign in to comment.