Commit graph

2547 commits

Author SHA1 Message Date
Joe Haddad
8222d571e7
Correctly fetch data for root route (#15149)
This PR corrects the data fetching behavior for optional root routes.

---

Fixes #14923
2020-07-14 18:58:02 +00:00
Joe Haddad
a131909857
Fix Web Workers with Fast Refresh (#15145) 2020-07-14 12:17:10 -04:00
Darsh Patel
fcd03091b4
Fix: Invalid flag provided to next build results in UnhandledPromiseRejectionWarning (#15049) 2020-07-13 23:07:35 +02:00
Joe Haddad
a8b2a8e617
v9.4.5-canary.32 2020-07-13 15:40:57 -04:00
Jan Potoms
cd79c829b1
Make sure bad links in router methods resolve in production (#15135)
edge-case I introduced in https://github.com/vercel/next.js/pull/14827
2020-07-13 19:28:32 +00:00
Joe Haddad
dfee55221c
Update Fast Refresh full reload warning (#15062)
We've added a Babel warning for unnamed default exports, and this PR addresses the remaining points in #13024.

Fixes #13024
2020-07-13 18:01:11 +00:00
Jan Potoms
3369d67bd1
Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off about 2.5Kb, according to the `size-limits` integration tests.
2020-07-13 16:08:12 +00:00
Jan Potoms
d2699be6e8
Trailing slash basepath (#14781)
Fixes https://github.com/vercel/next.js/issues/14757

Since https://github.com/vercel/next.js/pull/15041 has been sorted out, this can now be fully fixed
There was also a bug in the dev server that causes redirect loops
2020-07-13 14:59:40 +00:00
Jan Potoms
c9492a8cc9
Relax encoding on dynamic prerendered routes (#14717)
It should be enough to encode the characters that `path-to-regexp` uses as path delimiters (`/#?`).

Fixes https://github.com/vercel/next.js/issues/14691
2020-07-13 14:42:27 +00:00
Jason Miller
272080c9c0
Avoid aggressive state loop (#15068)
/cc @cristianbote
2020-07-13 13:12:18 +00:00
JJ Kasper
2d9d649d49
Add handling for custom-routes with basePath (#15041)
This adds handling for custom-routes with `basePath` to automatically add the `basePath` for custom-routes `source` and `destination` unless `basePath: false` is set for the route. 

Closes: https://github.com/vercel/next.js/issues/14782
2020-07-12 19:03:49 +00:00
Tim Neutkens
8a8ef641d8
Update ignored patterns for webpack 4 (#15096)
Found while working on figuring out this bug: https://twitter.com/timneutkens/status/1282129714627448832

 I noticed that the node_modules got passed by the ignore still because when chokidar identifies a ignore pattern is a glob it treats the glob as-is instead of appending `/**` to the glob
2020-07-12 14:03:17 +02:00
JJ Kasper
fed7e093f5
Make sure additional query values aren't added for auto-export (#15037)
This makes sure we don't add an undefined query value for auto-export pages for auto-export pages unnecessarily 

Fixes #15023
2020-07-10 03:16:02 +00:00
Cristian Dominguez
f4f6fea71f
CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902 

I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.

I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts?
2020-07-10 01:29:03 +00:00
Tim Neutkens
525fc360ae
Exclude node_modules in watchOptions (#15020) 2020-07-09 19:58:39 +02:00
Cristian Dominguez
887d436043
Use HEAD req for isUrlOk check (#14994)
Co-authored-by: Cristian Dominguez <cristiand391@users.noreply.github.com>
2020-07-09 11:52:49 -04:00
Tim Neutkens
096c9a33d2 v9.4.5-canary.31 2020-07-09 16:32:24 +02:00
Tim Neutkens
ab4a90b0d9
Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
2020-07-09 14:31:06 +02:00
Tim Neutkens
10408241f7
Make serverless-plugin compatible with webpack 5 (#15010)
Co-authored-by: Zack Jackson <zackary.l.jackson@gmail.com>
2020-07-09 14:30:40 +02:00
Darsh Patel
6d7cf2a934
Convert profiling mode from configuration option to CLI switch (#14920)
Removed Option to enable `ReactProductionProfiling` from configuration and added a CLI switch for the same.
Users can now do `next build --profile`  to enable react production profiling. 
Also added a warning to notify users about the performance impact

Fixes: #14688
2020-07-09 11:39:12 +00:00
illuminist
ada41a8bd0
Update next-bundle-analyzer readme (#14976)
https://github.com/vercel/next.js/issues/14969

It didn't specify on how to include the config with function config. This PR clarify the way to use the config with function.
2020-07-09 08:24:21 +00:00
Jan Potoms
33ebda1b7d
Fix root route optional catch-all prerendering (#14986)
Fixes https://github.com/vercel/next.js/issues/14964
2020-07-09 04:21:49 +00:00
JJ Kasper
62902545df
v9.4.5-canary.30 2020-07-08 14:51:37 -05:00
JJ Kasper
16590f7606
Make sure routeKeys are PCRE compliant (#14987)
This adds additional checks against the routeKeys used to build the named regexes for dynamic routes to ensure they follow PCRE rules for named capture groups

x-ref: https://github.com/vercel/vercel/pull/4813
2020-07-08 18:45:53 +00:00
Joe Haddad
85057e5417
v9.4.5-canary.29 2020-07-07 02:11:43 -04:00
Ty Mick
1f5bbb3a8c
Add warning when viewport meta tag is added to _document.js (#13452)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-07 01:43:16 -04:00
Jan Potoms
3623d444c1
Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848

when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes basepath with one that excludes  it, so `pushState` is always used. This makes sure the behavior is the same as when running next.js without a basepath
2020-07-07 05:24:38 +00:00
Ben Botvinick
d19c34353d
Add res.redirect response helper (#14705)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-07-07 01:06:16 -04:00
Jan Potoms
2f78d8858f
basePath: Resolve links against router pathname instead of window.location (#14804)
Currently following links are broken when using `basePath`:
```jsx
// pages/hello.js
    <Link href="#hashlink">
      <a id="hashlink">Hash Link</a>
    </Link>
```
with `basePath: '/docs'`, this will navigate to `/docs/docs/hello#hashlink` instead of `/docs/hello#hashlink`

I have a further optimization that builds on this branch that removes `url.parse` and `url.resolve` in favor for `new URL()` in router and link. Will PR when this gets merged.
2020-07-07 04:52:26 +00:00
Asher Foster
33234ca1f1
Attach previewData to API Route request (#13373)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-07-06 23:41:16 -04:00
JJ Kasper
38bd1a024c
Re-enable scroll restoration behind flag (#14046)
This updates the scroll position saving to occur as the scroll position changes instead of trying to do it when the navigation is changing since the `popState` event doesn't allow us to update the leaving history state once the `popState` has occurred. 

The order of events that was previously attempted to save scroll position on a `popState` event (back/forward navigation)

1. history.state is already updated with state from `popState`
2. we replace state with the currently rendered page adding scroll info
3. we replace state again with the `popState` event state overriding scroll info

Using this approach the above event order is no longer in conflict since we don't attempt to populate the state with scroll position while it's leaving the state and instead do it while it is still the active state in history

This approach resembles existing solutions:
https://www.npmjs.com/package/scroll-behavior
https://twitter.com/ryanflorence/status/1029121580855488512

Fixes: https://github.com/vercel/next.js/issues/13990
Fixes: #12530
x-ref: https://github.com/vercel/next.js/pull/14075
2020-07-06 14:27:45 +00:00
Tim Neutkens
55bfafc8a7
Add webpack peerdependency to react-dev-overlay (#14842) 2020-07-05 17:42:33 -04:00
matamatanot
62ef872989
Change authors member and links (#14367) 2020-07-05 11:36:50 +02:00
Tom Dohnal
2a99f591c4
Ie11 polyfills (#13704)
This resolves https://github.com/vercel/next.js/issues/12713 and https://github.com/vercel/next.js/issues/12722
2020-07-04 10:38:23 +00:00
Tim Neutkens
eecc73702b v9.4.5-canary.28 2020-07-03 13:31:38 +02:00
Tim Neutkens
c5e1e48e5a
Replace extra source line in webpack 5 (#14793)
Co-authored-by: Joe Haddad <timer@zeit.co>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-03 13:30:52 +02:00
Darsh Patel
e84537f88e
add NextWebVitalsMetric type for reportWebVitals (#14675)
Fixes: #13512
Defined and exported type for `metric`  used in [reportWebVitals](https://nextjs.org/docs/advanced-features/measuring-performance)

```
export function reportWebVitals(metric) {
  if (metric.label === 'custom') {
    console.log(metric) // The metric object ({ id, name, startTime, value, label }) is logged to the console
  }
}
```

One can now do 
```
import { NextWebVitalsMetric } from 'next/app'
export function reportWebVitals(metric: NextWebVitalsMetric ) {
  if (metric.label === 'custom') {
    console.log(metric) // The metric object ({ id, name, startTime, value, label }) is logged to the console
  }
}
```
2020-07-03 03:36:13 +00:00
JJ Kasper
a0c683208a
Fix URL being updated with basePath for 404 page (#14740)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-02 11:11:57 +02:00
Jan Potoms
dd97c984b2
Convert link to function component (#14633)
Convert `Link` to a function component. Prefetch logic and memoized url formatting now meshes nicely with React hooks. Class methods were hoisted to module scope to preserve performance characteristics.
2020-07-02 04:53:17 +00:00
JJ Kasper
dc49cd33eb
Update warning for rewriting to auto-export dynamic pages (#14751)
Since the no-op rewrite is a valid rewrite used to check pages/assets before adding a 404-rewrite this makes sure we don't show the rewriting to auto-export dynamic pages warning from it

Closes: https://github.com/vercel/next.js/issues/14736
2020-07-02 04:12:41 +00:00
Jan Potoms
066a18ffc8
Fix basepath root handling (#14756)
Fixes https://github.com/vercel/next.js/issues/14734
2020-07-02 03:48:10 +00:00
Tim Neutkens
9e83ba8cf6 v9.4.5-canary.27 2020-07-01 20:49:52 +02:00
Tim Neutkens
c5cc6072d0
Use single webpack runtimeChunk for Node.js compilation (#14722)
Webpack 5 supports a single runtimechunk for the Node.js compilation, this solves sharing modules between entrypoints.
2020-07-01 15:34:00 +00:00
Tim Neutkens
260707de68
Add etag support for getServerSideProps/getStaticProps pages (#14760)
Fixes #11711

Also cleaned up some extra code.

This was already supported on the Vercel edge network.
2020-07-01 14:59:18 +00:00
JJ Kasper
4a107b6994
v9.4.5-canary.26 2020-06-30 17:21:24 -05:00
JJ Kasper
dd644945ea
Fix encoding for env files in serverless mode (#14750)
This makes sure to base64 encode the `.env*` file contents before passing them in the URL for the serverless-loader since `!` is a special character in this case which can cause webpack to fail to build

Closes: https://github.com/vercel/next.js/issues/14749
2020-06-30 21:33:37 +00:00
Joe Haddad
cbb1c5c755
v9.4.5-canary.25 2020-06-30 11:54:20 -04:00
Joe Haddad
ea1f45a388
Add no-anon-default-export Babel lint rule (#14519)
Fixes #12291 

![image](https://user-images.githubusercontent.com/616428/85499698-176b4900-b5b0-11ea-8a5d-a7f0b4c20307.png)
2020-06-30 13:05:29 +00:00
Yang Sun
a8d2c1ee95
modify global css import error message (#14639)
Fixes #14464
2020-06-30 05:25:02 +00:00
Jan Potoms
ab7010711f
Avoid pulling extra code in the bundles for trailingSlash logic (#14696)
* avoid pulling code in the bundle for `trailingSlash` logic when it's not enabled
* avoid cloning the url an extra time if normalizing the path doesn't change it
2020-06-30 04:06:39 +00:00