Commit graph

3255 commits

Author SHA1 Message Date
JJ Kasper
1e9f45931c
v10.1.4-canary.15 2021-04-22 09:51:04 -05:00
Shu Ding
6cd1c87451
Fix not exposing server errors in hot reloader (#24331)
Fixes #24056.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-22 11:47:15 +00:00
JJ Kasper
85d87a3795
Ensure dev overlay is triggered for more _app/_document errors (#24328)
This expands on https://github.com/vercel/next.js/issues/24070 and ensures we show the dev overlay for additional cases like where `_app` or `_document` have syntax errors causing compilation to not be able to complete. This achieves showing the dev overlay even when compilation fails from a syntax error by doing a third minimal compilation in development with the needed client-side assets to render the dev overlay. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

x-ref: https://github.com/vercel/next.js/issues/24070
2021-04-22 11:08:47 +00:00
JJ Kasper
1caa7f4971
Bump next-babel-loader cache key (#24335)
This bumps the babel cache key since we modified the `react-loadable` babel plugin and we don't want any cached versions used since the module names generated in previous cached version won't match the newly expected values. 

x-ref: https://github.com/vercel/next.js/pull/24281 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-22 08:26:07 +00:00
Janicklas Ralph
9edb1ef16d
Adding script loader files to package.json (#24326)
Adding script loader files to package.json
2021-04-22 03:35:38 +00:00
Kyle Marshall
a29d8c9eaf
Ensure locale key not duplicated when navigating back to root path with a query or hash value (#24323)
This ensures that a duplicate locale key is not prepended to the path when navigating back (using browsers back button) to the root path containing query parameters or a hash value.

Current behaviour:
* `/fr?value=1` -> `/fr/another` -> click browser back button -> `/fr/fr?value=1`
* `/fr?value=1` -> `/fr?value=2` -> click browser back button -> `/fr/fr?value=1`
* `/fr#section` -> `/fr/another` -> click browser back button -> `/fr/fr#section`
* `/fr#section` -> `/fr#another` -> click browser back button -> `/fr/fr#section`

Fix:
Remove query string or hash value from path before determining whether to add the locale to the path in `addLocale` function.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: #24287
2021-04-22 03:06:26 +00:00
Tim Neutkens
03cc0f89ed v10.1.4-canary.14 2021-04-21 13:59:43 +02:00
Tim Neutkens
755fc6f0da v10.1.4-canary.13 2021-04-21 13:59:04 +02:00
Tobias Koppers
08baf526ff
improve react-loadable-plugin (#24281)
Co-authored-by: JJ Kasper <jj@jjsweb.site>



## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added


Closes: https://github.com/vercel/next.js/issues/22741
2021-04-21 11:18:05 +00:00
Tobias Koppers
710ad29714
webpack 5.35 (#24293)
* memory usage improvements for `next dev`
2021-04-21 10:06:16 +00:00
JJ Kasper
bfac04dcbc
v10.1.4-canary.12 2021-04-20 16:06:53 -05:00
tarunama
7fd5a24d94
feat: add type to previewData (#21574)
`previewData` was already [typed declare variable](https://github.com/vercel/next.js/compare/canary...tarunama:feature/remove-any1?expand=1#diff-bd7baf53ff559d84461af8b2fd62cade7e2d8eb203f489e24a27c5b83a79a9d3L1380).
So I have defined `PreviewData` type, and adapt for avoiding error by type safe.
2021-04-20 18:13:48 +00:00
Gerald Monaco
1f5f0d313a
Fix metrics measurements under new root API (#24110)
Previously, we weren't recording most (all?) of the Next.js measurements like `Next.js-hydration` in Concurrent Mode. This was mainly because the new API doesn't accept a callback.

Instead of special casing this, I've refactored it so that the measurements are just recorded when Root first flushes (via `useLayoutEffect`), which should be more or less the same timing for the old API.

Concurrent Mode is a little trickier for two reasons:

1. Flushes might be (slightly) delayed due to time-slicing and prioritization
2. Selective hydration might skew measurements in cases where full hydration is aborted

I don't have a good answer for those yet, so they'll need to be addressed when the time comes.
2021-04-20 15:37:32 +00:00
Tim Neutkens
8d84b08752
Add event for webpack 5 usage (#24222) 2021-04-20 16:46:40 +02:00
JJ Kasper
e532c58c23
Ensure locale cookie does not error with similarly named cookie (#24182)
This ensures we don't error when a cookie with a similar name to the `NEXT_LOCALE` cookie is present. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23787
Closes: https://github.com/vercel/next.js/pull/23788
2021-04-20 13:41:14 +00:00
Dale Bustad
b2d8e15d1e
Babel Turbo Loader, Part 2 (#24078)
This PR addresses the potential for memory leakage with the previous caching scheme; it should also be more efficient, resulting in fewer instances where a fresh Babel config must be generated.  Documentation has been added, and `overrides` have been removed in favor of conditional plugins for consistency.

This approach is easier to break, in that `CharacteristicsGermaneToCaching` must be correct for all cases.  However, it means that <= 8 configs will need to be generated within the context of a single thread, and the config-caching is about as fast as we can get it.
2021-04-20 08:45:57 +00:00
JJ Kasper
bfde2833c0
v10.1.4-canary.11 2021-04-19 21:41:09 -05:00
JJ Kasper
aab6b37e50
Omit un-necessary stack trace from invalid routes (#24240)
This removes the extra stack trace from throwing an error instead of logging and then exiting since the stack trace doesn't provide any additional information that is helpful for debugging in this case. 

<details>

<summary>Before screenshot</summary>

![image](https://user-images.githubusercontent.com/22380829/115301794-4f3b1280-a127-11eb-8a0d-0797efb8fc9f.png)


</details>

<details>

<summary>After screenshot</summary>

<img width="962" alt="Screen Shot 2021-04-19 at 3 53 45 PM" src="https://user-images.githubusercontent.com/22380829/115301901-6ed23b00-a127-11eb-83f9-e3f4cf0ed8fe.png">


</details>
2021-04-20 02:03:46 +00:00
Tobias Koppers
155e34c3a6
upgrade webpack to 5.34 (#24230) 2021-04-19 18:18:07 +00:00
Tim Neutkens
aee453e219
Disable strictExportPresence when webpack 5 is enabled (#24214)
Solves an issue some users ran into where enabling webpack 5 highlighted a wrong JSON import where named exports were used for JSON data.

> Should not import the named export 'myValue' (imported as 'myValue') from default-exporting module (only default export is available soon)
2021-04-19 18:50:09 +02:00
Kristoffer K
d24a0c18c1
ci: fix PnP e2e tests using Webpack 5 (#24216)
Fixes the e2e PnP tests by updating `enhanced-resolve` to get the fix in https://github.com/webpack/enhanced-resolve/pull/289, the tests started failing in https://github.com/vercel/next.js/pull/23810

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-19 14:43:55 +00:00
JJ Kasper
0bcc6943ae
v10.1.4-canary.10 2021-04-18 08:59:27 -05:00
Tobias Koppers
5bdef6aabe
startup performance improvements (#24129)
* import next-server logic during the time the configuration is loaded
* load minimizer plugins only when used
* load ReactDevOverlay only when used
* load only meta information of tsconfig for validation
* make worker for configuration loading lighter
* only load runTypeCheck when used
* load postcss config only when used
2021-04-18 10:28:09 +00:00
JJ Kasper
65588083db
Ensure query for static pages with rewrites is updated correctly (#24189)
This updates the query refreshing on the client to also refresh when rewrites are used and the page is static since additional query values can be provided from rewrites that are relied on client-side. An additional test has been added in the custom-routes suite to ensure this is working correctly. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23490
Fixes: https://github.com/vercel/next.js/issues/22931
Fixes: https://github.com/vercel/next.js/issues/21062
2021-04-18 10:00:04 +00:00
JJ Kasper
6e7245cddb
Add error for getStaticPaths on non-dynamic page (#24188)
Noticed in this issue the reproduction was using `getStaticPaths` on a non-dynamic page incorrectly although we don't currently show an error for this. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

x-ref: https://github.com/vercel/next.js/issues/22931
2021-04-18 09:31:40 +00:00
JJ Kasper
a153b63240
Ensure locale is not duplicated from differing casing (#24187)
This ensures we don't attempt adding a locale to a path when the locale is already present but in a different casing, this also ensures we successfully remove the locale if the casing differs in the path. Additional tests have been added in the `i18n-support` suites to ensure this is working correctly. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23553
2021-04-18 09:01:01 +00:00
umarsenpai
9fcfce3463
Fix serving Images through external rewrite with Image component (#21001)
This PR fixes the issue described here: https://github.com/vercel/next.js/issues/20909

The _req passed to getRequestHandler doesn't have `on` function which is required by http-proxy. It throws the error e.on is not a function. We should also wait for buffer to finish writing before sending the response. 

Fixes: https://github.com/vercel/next.js/issues/20909
Closes: https://github.com/vercel/next.js/issues/24177
2021-04-17 21:03:08 +00:00
JJ Kasper
432c9ee5fc
Use same num workers between export and build (#24180)
This ensures we use the same `numWorkers` config between `next build` and `next export` since we already calculate the correct value to use [in the config](6e22a440e2/packages/next/next-server/server/config-shared.ts (L99-L103)). 

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23318
2021-04-17 20:09:26 +00:00
JJ Kasper
fe0583edea
v10.1.4-canary.9 2021-04-16 10:09:07 -05:00
JJ Kasper
7d77a19af2
Fix fallback: false triggering 404 before rewrites (#24121)
This fixes dynamic pages with `fallback: false` that don't have a matching path causing a 404 before rewrites are checked unexpectedly. This ensures we treat `fallback: false` pages as a match only if they also have a matching static path so that fallback rewrites can be triggered correctly. An additional test suite as been added to ensure this is working as expected. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-04-16 15:07:24 +00:00
Martin Alix
b2ee0a93fe
Fix IE11 incompatibility due to string litterals (#23784)
Fixes #22270

## Bug

- [X] Related issues linked using `fixes #number`
- [  ] Integration tests added
2021-04-15 16:34:52 +00:00
JJ Kasper
3fb4e091bc
v10.1.4-canary.8 2021-04-15 09:50:36 -05:00
Tobias Koppers
1c2ee7c6b8
improve pr stats action (#24086)
* add cache build duration tracking
* default = webpack 5
* better hash handling
* allow to opt-out of webpack5 via `future.webpack5: false`
2021-04-15 11:46:56 +00:00
JJ Kasper
1797fc50ab
Fall back to default components when a top-level error occurs (#24079)
This fixes an internal server error showing when a top-level error occurs in `_app` in development instead of the dev overlay. This includes the failing test case from https://github.com/vercel/next.js/pull/24069 and also ensures the overlay is cleared when the error is corrected. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/24070
Closes: https://github.com/vercel/next.js/pull/24069
2021-04-15 10:19:19 +00:00
Tobias Koppers
1e207301c2
update webpack to 5.33 (#24077)
relevant changes:

* performance improvements for `export *` and reexports
* fixes incorrect cache invalidation when new properties are added to the DefinePlugin (fixes #23901)
2021-04-14 21:23:13 +00:00
Joe Haddad
880935842f
fix: upgrade cssnano/postcss version (#24034)
This PR upgrades CSSNano and PostCSS to v8, fixing various longstanding PostCSS bugs in PostCSS@7. This should yield an overall install size win.
2021-04-14 08:44:07 +00:00
Gerald Monaco
cb7ef3feb5
Add react@experimental testing (#23359) 2021-04-13 19:16:45 +02:00
JJ Kasper
c3390b8cca
v10.1.4-canary.7 2021-04-13 11:35:21 -05:00
Tim Neutkens
9baee888af
Clean up eventsource initialization (#24015)
Just cleans up some code, doesn't change the underlying mechanism



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-13 16:32:36 +00:00
JJ Kasper
4d291bd810
Use regex lexer for gathering named groups from has (#23626)
This is a follow-up to https://github.com/vercel/next.js/pull/23588 to update to use a regex lexer to gather the named regex groups instead of attempting to gather them through executing the regex since it can fail to gather the regex groups when they are using specific matching. This also ensures we don't pass the value as a segment when value is defined and it doesn't use a capture group. Additional tests are added to cover these cases and documentation updated to reflect this. 

Closes: https://github.com/vercel/next.js/issues/23415

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-13 12:34:51 +00:00
Shu Ding
b610db830e
Add request deduplication to image optimizer (#24000)
This PR adds the deduplication logic to image optimizer so the cache will be reused as much as possible if there're multiple concurrent requests.

Fixes #23436.

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-12 22:38:51 +00:00
Tim Neutkens
25ca1b5bab v10.1.4-canary.6 2021-04-12 19:58:36 +02:00
Tim Neutkens
2dba861ea3
Enable webpack5 by default (#23810)
- Enable webpack 5 by default for apps without custom webpack configuration

Fixes #23143



## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-12 17:52:43 +00:00
JJ Kasper
1be97547d9
v10.1.4-canary.5 2021-04-12 11:33:08 -05:00
JJ Kasper
ec62ea6134
Ensure minimal mode SSR 404 handling is correct (#23996) 2021-04-12 11:31:51 -05:00
JJ Kasper
f02363e0c4
Ensure no-op rewrite matches dynamic route with i18n correctly (#23860)
This ensures we match dynamic routes correctly when applying `check: true` behavior with i18n so that no-op rewrites match dynamic routes correctly. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23854
2021-04-12 09:42:01 +00:00
Tim Neutkens
c5c16494e3 v10.1.4-canary.4 2021-04-12 10:34:17 +02:00
Tim Neutkens
2b48670bd6
Remove bugfix needed for webpack 4 when webpack 5 is used (#23886)
Tobias has fixed the `compiler.hooks.invalid.call()` bug in webpack 5 so this is no longer needed



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-11 15:06:35 +00:00
Tobias Koppers
2c2ac2e868
reduce the number of write syscalls by buffering (#23863)
buffer the output of bfj to avoid 1000s of small write calls
2021-04-09 21:43:30 +00:00
Tobias Koppers
1258d13d73
upgrade webpack to 5.31.2 (#23861)
https://github.com/webpack/webpack/releases/tag/v5.31.1

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-09 18:31:26 +00:00