Commit graph

4169 commits

Author SHA1 Message Date
Tim Neutkens
60f198584d
Add internal mode for debugging Next.js core webpack (#29254)
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-09-22 07:20:18 +02:00
Steven
9c86953745
Rename experimental tracing to outputFileTracing (#29267)
Renaming this prop for clarity before we move this out of experimental
2021-09-21 22:18:12 +00:00
jj@jjsweb.site
53a59336e9
v11.1.3-canary.29 2021-09-21 16:12:44 -05:00
jj@jjsweb.site
7b74f7771c
v11.1.3-canary.28 2021-09-21 14:19:19 -05:00
Tim Neutkens
dc43e297b7 v11.1.3-canary.27 2021-09-21 19:37:49 +02:00
Tobias Koppers
4f212ee91d
the way towards webpack 5 typings (#29105)
Co-authored-by: sokra <sokra@users.noreply.github.com>
2021-09-21 19:17:16 +02:00
Tim Neutkens
90a3b50ce1
Remove collect-dependencies span as it balloons trace size (#29266)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-21 19:10:13 +02:00
JJ Kasper
800b2beef6
Remove docker usage for running development tests (#29264) 2021-09-21 19:04:23 +02:00
JJ Kasper
b4d8aa8c48
Fix default static /500 with i18n (#29250) 2021-09-21 16:23:23 +02:00
JJ Kasper
d5b1d595c5
Fix basePath: false not being honored for client-side redirect (#29235)
* Fix basePath: false not being honored for client-side redirect

* update test

* fix remove flakey exit
2021-09-21 09:23:13 -05:00
Tobias Koppers
84c299bd57
upgrade webpack to 5.53.0 (#29168) 2021-09-21 16:22:57 +02:00
JJ Kasper
50c75282cd
Fix resolving href with query and matching as (#29246) 2021-09-21 16:21:27 +02:00
JJ Kasper
8e52126ea6
Migrate prerender tests to new set-up (#29245) 2021-09-21 16:21:05 +02:00
JJ Kasper
371ca582d1
Ensure trailingSlash is correct for index with query (#29217) 2021-09-21 16:18:42 +02:00
Maia Teegarden
4a5fc41b24
Fix dynamic style issue (#29163)
* Fix dynamic style issue

* Update affected tests

* Build next-swc binaries

* Remove clone

* Build next-swc binaries
2021-09-21 16:14:38 +02:00
Tim Neutkens
adf7fa67d3 v11.1.3-canary.26 2021-09-21 09:50:33 +02:00
Tim Neutkens
2b57edc63a
Add spans for hot-reloader start (#29251) 2021-09-21 09:49:53 +02:00
Tobias Koppers
e90825ad88
fix compilation relationship (#29174)
* fix compilation relationship

* fix compilation relationship

* Ensure loader span is provided correctly

* Fix webpack 4 childcompiler run

* Use compilation hook instead of make hook

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-09-20 22:19:00 +02:00
jj@jjsweb.site
0568d24205
v11.1.3-canary.25 2021-09-20 09:30:41 -05:00
Luan Devecchi
23ce41e2bc
Preserve next-env.d.ts line ending (#28100)
* Preserve `next-env.d.ts` line ending

Prevent next from changing already existing line ending on
`next-env.d.ts` for no good reason

* Update comparison

Co-authored-by: Steven <steven@ceriously.com>

* Update checks and add tests

* update test

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-09-19 22:55:46 -05:00
Emilio Cobos Álvarez
05a732eb7a
Remove useless getComputedStyle call. (#27969)
See https://github.com/w3c/csswg-drafts/issues/6501 to see how I found this.

This line doesn't recompute layout in browsers, because `"height"` is given as a pseudo-element name rather than a property.

The right way to do what it wants is `getComputedStyle(document.body).height`, but given nobody noticed this (and this is generally never needed, manually triggering layout should never be needed to avoid FOUC) it seems better to keep current behavior and just remove the call.
2021-09-20 03:03:36 +00:00
JJ Kasper
5b963422c0
Fix array query value has matching (#29216) 2021-09-19 20:32:30 -05:00
Flo
76dee14db4
Fix #11107 - don't prefetch preloaded modules (#22818)
This PR proposes a fix for https://github.com/vercel/next.js/issues/11107 (JS modules are loaded twice). A more detailed explanation of the investigation that led to this PR can be found in the issue's comments (https://github.com/vercel/next.js/issues/11107#issuecomment-791780168).

## Replicability

To identify that the issue replicates on any given project, you need to 
1. look at the network tab (first/clean load of site, so preferably ⌘+⇧+R on an incognito tab), 
2. sort by "name", and filter requests by `mime-type:application/javascript` (selecting "JS" in the devtools filters will actually show all "script" types, but ignore all "javascript" types)
3. look for pairs of identical calls with one originating from initial HTML (`preload` of priority "high" originating from "(index)" or "([page name])")  and another one from a script (`prefetch` of priority "lowest" originating from a .js file), where neither of the files is served from the cache.

Here's a screenshot of an example of what to look for:
<img width="601" alt="Screen Shot 2021-03-07 at 09 59 18" src="https://user-images.githubusercontent.com/1325721/110234627-cf1c6d00-7f2b-11eb-9cd7-749bf881ba56.png">


The issue was reproduced easily on the following projects:
- On [nextjs.org](https://nextjs.org/) where duplicates add up to ~70kB of transferred javascript out of 470kB (14.9%).
- On [vercel.com](https://vercel.com/) where duplicates add up to ~105kB of transferred javascript out of 557kB (18.8%).
- On [tiktok.com](https://tiktok.com/en) where duplicates add up to ~514kB of transferred javascript out of 1556kB (33%).
- In my own project using `"next": "^10.0.1"` (private repo) where duplicates add up to about 5% of total transferred javascript.
- In the issue's comments, a developer reported a replication using `"^10.0.7"` on a [public repo](https://github.com/SidOfc/sidneyliebrand.io).


## Some information about the fix

- Both `preload` and `prefetch` values for `<link rel="x">` behave similarly, with the difference being in network priority level (preload is high priority, prefetch is lowest priority).

- Next.js uses `<link rel="preload">` in its initial HTML but then *only* uses `<link rel="prefetch">` for the rest of the lifetime of the page. 

- However, when Next.js detects that a script should be requested in advance, it only checks for matching `<link rel="prefetch">` and not `<link rel="preload">` (which have higher priority and are present earlier in the DOM, thus have a greater likelihood of being already loaded). 

This PR aims to fix that oversight.

## Potential issues (none AFAIK)

As far as I can tell by looking through the codebase, **there is no downside** not to add a `prefetch` when a `preload` is already in the DOM. No other script looks for a `<link>` based on its `rel` attribute.
2021-09-19 17:51:04 +00:00
Andrew Hurle
88f27ef947
Fix bug where returning { notFound: true } from GSP broke next export (#24481)
* Fix bug where returning `{ notFound: true }` from GSP broke `next export`

We could just as easily omit the notFoundRoutes check, but I didn't want
to mask other potential bugs that would result in missing files

* update check

* move check

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-09-18 10:20:45 -05:00
jj@jjsweb.site
f579767e60
v11.1.3-canary.24 2021-09-17 15:00:16 -05:00
Tobias Koppers
797dabe351
add support for new URL() (#28940)
Currently `new URL()` for server assets is completely broken because of the `publicPath` that is used for them too. `new URL()` for SSR is broken on windows as it's using absolute urls on the windows filesystem. And `new URL()` is using an incorrect filename

* Place all `asset`s correctly in `/_next/static/media` with `[name].[hash:8][ext]`
* Added a separate runtime chunk for api entries, without `publicPath`
* Introduce separate layer for api entries, which uses server-side URLs.
* Otherwise new URL() will return a faked relative URL, that is identical in SSR and CSR
* Disables react-refresh for api entries

Fixes #27413



## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## 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`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-09-17 19:20:09 +00:00
Tobias Koppers
e3c6739ee0
make code consistent with babel externals (#28867)
* make code consistent with babel externals

* update compiled

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-17 12:27:03 -05:00
Tobias Koppers
fa9ee197a4
suggest incremental typescript for typescript >= 4.4.2 (#29169)
This is now safe to enable since it no longer causes performance regressions
2021-09-17 15:42:27 +00:00
Tim Neutkens
367f8d6e6d v11.1.3-canary.23 2021-09-17 09:35:40 +02:00
Tim Neutkens
002ed25087
Add name to invalidated span (#29170) 2021-09-17 09:34:37 +02:00
Tim Neutkens
84ce15bba5 v11.1.3-canary.22 2021-09-16 19:48:00 +02:00
Tim Neutkens
3e8f470e49
Ensure traces are flushed in development when there is an error (#29149) 2021-09-16 19:43:28 +02:00
Maia Teegarden
16a737d9b5
Update expected test output (#29146) 2021-09-16 11:52:16 -05:00
Tobias Koppers
d78bb6fe46
upgrade to typescript 4.4.3 (#29112)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-16 18:06:57 +02:00
JJ Kasper
cefd9cf283
Add crawler blocking for fallback: true (#29121)
* Add crawler blocking for fallback: true

* update test

* Update check

* Add note to docs

* use browser agent for non-crawler test
2021-09-16 11:01:28 -05:00
Tim Neutkens
e98690c307 v11.1.3-canary.21 2021-09-16 17:13:46 +02:00
Tim Neutkens
2ac5e1c1f0
Build next-swc binaries (#29144)
Co-authored-by: timneutkens <timneutkens@users.noreply.github.com>
2021-09-16 17:12:08 +02:00
강동윤
81c5511b74
next-ssg: Don't inject __N_SSP for files without server props. (#29141) 2021-09-16 16:26:38 +02:00
Tim Neutkens
10daef9607
Ensure Next.js dist files are commonjs compatible with swcLoader enabled (#29138)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-16 16:11:30 +02:00
Tim Neutkens
60560a941d v11.1.3-canary.20 2021-09-16 15:48:46 +02:00
Tim Neutkens
c39b7d19bd
Update next-swc binaries (#29140)
Co-authored-by: timneutkens <timneutkens@users.noreply.github.com>
2021-09-16 15:47:46 +02:00
강동윤
2c82615bde
Fix transform of ` in styled-jsx (#29136) 2021-09-16 15:08:42 +02:00
Tim Neutkens
c491adfe12 v11.1.3-canary.19 2021-09-16 08:59:20 +02:00
Tim Neutkens
172a536c61
Update next-swc binaries (#29132)
Co-authored-by: timneutkens <timneutkens@users.noreply.github.com>
2021-09-16 08:58:36 +02:00
Maia Teegarden
c6cec752c7
Fix partial one off global selectors (#29128) 2021-09-16 08:16:10 +02:00
JJ Kasper
e313398468
Update trace ignores for next import (#29119) 2021-09-15 15:00:52 -05:00
Tim Neutkens
1f788b5430
Development tracing improvements (#29076) 2021-09-15 20:06:24 +02:00
JJ Kasper
85b8399856
Remove log from failing to parse source map (#29118)
This removes the log when we fail to parse the source maps in the `wellknown-errors-plugin` since this log isn't really actionable by users and clutters the error output. 

x-ref: https://github.com/vercel/next.js/issues/27783#issuecomment-915654054
2021-09-15 17:53:22 +00:00
Janicklas Ralph
73408211aa
Remove inert font tag in font optimization (#28869)
* Remove inert font tag in font optimization

* Fix lint

* Remove inert font tag during font optimization

* Fix lint

* Fix lint

* Fix lint

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-15 11:43:13 -05:00
Tim Neutkens
4b41b48a8e v11.1.3-canary.18 2021-09-15 17:34:32 +02:00