Commit graph

421 commits

Author SHA1 Message Date
JJ Kasper
f56a1505c2
Fix incorrect error manifest path (#27970) 2021-08-11 12:07:09 -05:00
JJ Kasper
e61ea6f27b
Add manifest check step and add missing items (#27934) 2021-08-11 11:17:57 +02:00
Tim Neutkens
331fed89f3
Add Import trace for requested module when it fails to resolve (#27840)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-08-09 14:38:26 +02:00
JJ Kasper
5eaca0ffe5
Document i18n locale limit (#27542)
Add check for i18n locale count and ensure the limit is documented

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-27 20:09:36 +00:00
Luís Galete
57501fa745
Fix typo in placeholder-blur-data-url error docs (#27510)
2021-07-26 17:04:47 +00:00
brijendravarma
74b159c850
Updated the Error message describing the alternative and added styles… (#14652)
The error message indicates better alternatives and added styles.css sample snippet for good visibility.

![Global_error_msg](https://user-images.githubusercontent.com/38159218/85950309-ac3bc100-b979-11ea-9a8d-4a356cb8007c.JPG)
![CSS-Global](https://user-images.githubusercontent.com/38159218/85950319-b2ca3880-b979-11ea-829a-24335fcfc93d.JPG)
2021-07-25 04:53:33 +00:00
Steven
1d347ba5dc
Fix typo in error message (#27438)
Fixes typo mentioned in https://github.com/vercel/next.js/pull/27346#discussion_r675477904
2021-07-23 14:07:09 +00:00
Alex Castle
1b733423d6
Use Sharp if available for Image Optimization (#27346)
* Use sharp for image transformations when available

* Refactor resizeImage and add sharp warning

* only show sharp warning once per instance

* Modify sharp error message

* Add documentation for optional sharp dependency

* Update docs/basic-features/image-optimization.md

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

* Import types for sharp

* Update lockfile

* Add testing against sharp

* use fs-extra for node 12

* Rename test sharp path variable

* Apply suggestions from code review

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

* update squoosh specific test

* Apply suggestions from code review

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

* update tests

* Apply suggestions from code review

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

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-22 18:11:17 -05:00
Rodrigo Roim
a3b2205b42
[errors/no-cache] Prevent GitHub Actions cache from going stale (#27362)
Closes: https://github.com/vercel/next.js/issues/27129

This configuration is similar to what we've been using at Statsig, and it's the best general purpose config I could think of.

At Statsig we also invalidate our caches weekly, since sometimes we spend weeks without updating dependencies for some of our NextJS apps, and the artifact bloat means GitHub starts invalidating other caches in our repo. I could add that step to this diff as well, but I think that's a bit too specific (likely only a problem in monorepos with several caches). In any case, the previous example also has this problem.

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-22 03:12:39 +00:00
Josh Flayhart
ddef873b3b
Update next-image-unconfigured-host.md (#24953)
* Update next-image-unconfigured-host.md

the docs are misleading because I tried this and still got yelled at by compiler, and then added domains and it worked?

* Update next-image-unconfigured-host.md

* Update next-image-unconfigured-host.md

* Update next-image-unconfigured-host.md

* Update next-image-unconfigured-host.md

* Update next-image-unconfigured-host.md

* Update next-image-unconfigured-host.md

* remove unrelated section

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-19 19:40:52 -05:00
JJ Kasper
14dd7c2954
Add warning for large number of routes (#27214)
This adds a warning when more than 1024 routes are added since it can have performance impacts and includes a document that we can add suggestions to reduce the number of routes being added. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] 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`
- [ ] 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-07-16 14:59:54 +00:00
Tobias Koppers
f9795fdd26
improve static generation UX (#27171)
#### improve export spinner

update at least once a minute in non-tty
update progress regularly when using the spinner
decrease frequency of the spinner (windows console output is expensive)

#### restart static page generation and collecting page data worker pools when hanging

when for 1 minute no activity happens on the worker pool, restart it
log a warning for hanging jobs

#### add page generation duration to summary tree

![image](https://user-images.githubusercontent.com/1365881/125750454-8845f1b1-faf0-4598-b7a4-ea796b884691.png)

for `[+n more pages]` is will show `(avg 321 ms)` when the average is over the threshold.
It will allocate 8 lines for preview pages (instead of 4) when they contain slow pages

## 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.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-16 09:21:44 +00:00
Steven
8151a7e0dc
Add minimumCacheTTL config for Image Optimization (#27200)
- Closes #23328  
- Related to #19914 
- Related to #22319 


## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`
2021-07-15 19:55:12 +00:00
Houssein Djirdeh
c46b405ba7
adds no duplicate head rule (#27179) 2021-07-15 13:04:17 -05:00
Tobias Koppers
7a8da9741d
add support for esm externals (#27069)
add `experimental.esmExternals: boolean | 'loose'` config option

remove `output.environment` configuration in favor of `target`

|                          | `esmExternals: false` (default) | `esmExternals: 'loose'` | `esmExternals: true` |
| ------------------------ | ------------------------------- | ----------------------- | -------------------- |
| import cjs package       | `require()`                     | `require()`             | `require()`          |
| require cjs package      | `require()`                     | `require()`             | `require()`          |
| import mixed package     | `require()` ***                 | `import()`              | `import()`           |
| require mixed package    | `require()`                     | `require()`             | `require()`          |
| import pure esm package  | `import()`                      | `import()`              | `import()`           |
| require pure esm package | Error **                        | `import()` *            | Error **             |
| import pure cjs package  | `require()`                     | `require()`             | Resolving error      |
| require pure cjs package | `require()`                     | `require()`             | `require()`          |

cjs package: Offers only CJS implementation (may not even have an `exports` field)
mixed package: Offers CJS and ESM implementation via `exports` field
pure esm package: Only offers an ESM implementation (may not even have an `exports` field)
pure cjs package: CommonJs package that prevents importing via `exports` field when `import` is used.

`*` This case will behave a bit unexpected for now, since `require` will return a Promise. So that need to be awaited. This will be fixed once the whole next.js bundle is ESM. It didn't work at all before this PR.
`**` This is a new Error when trying to require an esm package.
`***` For mixed packages we prefer the CommonJS variant to avoid a breaking change.

## 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.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-10 16:49:02 +00:00
Steven
1a8ad14089
Rename next/image dangerously-unoptimized to custom and warn when applicable (#26998)
Since we are no longer accepting new built-in loaders, users may wish to use a different cloud provider.

So this PR renames `dangerously-unoptimized` to `custom` to handle this case as well as the intention of `next export`.

If the user doesn't add a `loader` prop, we throw an error.
If the user adds a `loader` prop but it doesn't return the width, we print a warning.

- Follow up to #26847 
- Fixes #21079 
- Fixes #19612 
- Related to #26850
2021-07-08 19:35:19 +00:00
Maia Teegarden
b8f3a6d2d9
5MB -> 4MB body size limit (#26887)
This decreases the body size limit that triggers a warning from 5MB -> 4MB, which provides a little more wiggle room. Certain things like using base64 on body, headers, path, etc can cause the response to be larger than initially calculated. 

Initial PR: https://github.com/vercel/next.js/pull/26831
2021-07-02 23:17:56 +00:00
Maia Teegarden
538095c936
Warn when response body is larger than 5mb (#26831)
This PR adds a warning when api responses exceed 5mb since this will end up failing once deployed. In a future version this scenario will throw an error.

## Bug

- [x] Integration tests added

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-02 19:27:33 +00:00
hiro
bdd1d85813
Fix typo on "occured" to "occurred" (#26876)
- Fix typo on "occured" to "occurred"
2021-07-02 16:06:50 +00:00
Tim Neutkens
59c742ee7f
Add instructions on how to add nextjs.org/docs/messages urls (#26865)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-07-02 13:39:00 +02:00
Peter Mekhaeil
94d7450a6e
chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
Duc Le
4f3674cc37
Correct the word "remove" (#26258) 2021-06-17 13:47:02 +02:00
Vadorequest
75016716dc
Doc "no-sync-scripts" remove experimental notice (#26225)
It's not experimental anymore.




## Documentation / Examples

- [ ] Make sure the linting passes
2021-06-17 08:19:26 +00:00
Ivan Kalinin
c851da25f4
Fixed no-img-element documentation snippet. (#26154)
Module "next/image" has no exported member 'Image'.
It must be `import Image from "next/image"`
2021-06-16 08:57:45 +02:00
JJ Kasper
225b784393
Ensure all errors are added in manifest (#26129)
* Ensure all errors are added in manifest

* Add script doc to manifest
2021-06-15 13:36:25 -05:00
Gerald Monaco
775c7be517
Update react-version.md (#26093)
Forgot to update this in a previous PR.
2021-06-14 20:24:36 +00:00
Tim Neutkens
de08b1fff1
Remove unsupported examples (#26075)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-14 20:27:06 +02:00
JJ Kasper
1628e6d16c
Update client-side default error (#25997)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-06-11 16:23:45 +02:00
Steven
d8b59f3e46
Add errors for invalid placeholder=blur usage (#25953)
There are strict conditions for using `placeholder=blur` documented in #25949 but this will give the user a better understanding during `next dev` and links to the error.

- Error when `placeholder=blur` and no `blurDataURL`
- The Error for small images with `placeholder=blur` has been changed to a warning
- Added support for blurring a webp image
- Added error page linking to relevant docs
2021-06-10 18:51:35 +00:00
John Jago
c6ba29da00
docs: use descriptive links instead of "click here" (#25897)
* docs: use descriptive links instead of "click here"

Linking text such as "here" or "click here" is not accessible (and
doesn't look that great either). The best example of why it's better to
use link text that provides context is that some screen readers allow
navigation by links alone. If all links say "click here", then how does
the user know which one to go to?

I tried to make the minimal change necessary to make the link text
descriptive but had to reword a few sentences that didn't read well.

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-09 13:23:16 -05:00
Tim Neutkens
e1502bc9a5
Enable webpack5 for all apps (#25639)
* Enable webpack 5 by default for all apps

Still provides a way to opt-out using `webpack5: false` in next.config.js. Also throws an error for `future.webpack5`.

* Update tests

* Update test to run on webpack 4 instead of webpack 5

* disable webpack5 for legacy tests

* Fix stats-config for webpack4

* update tests

* update size for webpack4 test

* move basic suite first

* update basic test

* Add logs

* remove outdated testFutureDependencies job

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-07 15:48:29 -05:00
Houssein Djirdeh
8ae12db1e3
ESLint Plugin: Fix Document and Head import rules (#25730) 2021-06-07 12:40:28 +02:00
Tim Neutkens
9890565983
Add helpful error for link with multiple children (#25657)
Makes sure a helpful error is shown for `<Link>` with multiple children



## 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-05-31 19:41:57 +00:00
Houssein Djirdeh
7426ebcbc3
ESLint Plugin: Image rules (#23402)
Adds a new image rule to `eslint-plugin-next`:

```
Do not use `<img>`. Use Image from `next/image` instead
```
2021-05-17 13:06:48 +00:00
Janicklas Ralph
7b0fe0d73b
Fix no-sync-scripts doc (#25062)
## Bug

Fix no-sync-scripts doc
2021-05-13 10:08:07 +00:00
Alessandro Ursino
2f142b622f
fix typo in path (#24978) 2021-05-11 13:05:03 +02:00
Houssein Djirdeh
6d0150f02e
ESLint Plugin: Prevent bad imports of next/document and next/head (#24832)
Adds lint rules to the Next.js ESLint plugin to:

- Disallow importing `next/head` inside `pages/_document.js`
- Disallow importing `next/document` outside of `pages/_document.js`

Both rules will be surfaced as **errors** within the recommended config of the plugin.

Fixes #13712 #13958
2021-05-10 21:28:06 +00:00
Houssein Djirdeh
44072205d8
ESLint Plugin: Custom Font at page-level rule (#24789)
Adds a lint rule warning to the Next.js ESLint plugin if a custom Google Font is added at page-level instead of with a custom document (`.document.js`)

_Note: This will be generalized to include more font providers in the near future._
2021-05-10 19:08:14 +00:00
Houssein Djirdeh
569da9d286
ESLint Plugin: passHref is not assigned (#24670)
Adds a lint rule warning to the Next.js ESLint plugin if `passHref=true` is not assigned for `<Link>` wrapping a custom component.

Fixes #23713
2021-05-10 18:35:11 +00:00
Houssein Djirdeh
59d50ff76d
ESLint Plugin: Google Font rules (#24766) 2021-05-10 10:03:28 +02:00
Houssein Djirdeh
656c2ef649
ESLint Plugin: Disallow <title> in Head from next/document (#24868)
Adds lint rule warning to the Next.js ESLint plugin to disallow `<title>` in `Head` imported from `next/document`.
2021-05-07 08:49:37 +00:00
Anthony Oyathelemhi
467ec2115c
Add additional reason for the Prerender Error when running next export (#24828)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-06 14:51:53 +02:00
Houssein Djirdeh
e783b0a2e8
Adds ESLint with default rule-set (#23702)
This PR re-includes ESLint with some notable changes, namely a guided setup similar to how TypeScript is instantiated in a Next.js application.

To add ESLint to a project, developers will have to create an `.eslintrc` file in the root of their project or add an empty `eslintConfig` object to their `package.json` file.

```js
touch .eslintrc
```

Then running `next build` will show instructions to install the required packages needed:

<img width="862" alt="Screen Shot 2021-04-19 at 7 38 27 PM" src="https://user-images.githubusercontent.com/12476932/115316182-dfd51b00-a146-11eb-830c-90bad20ed151.png">

Once installed and `next build` is run again, `.eslintrc` will be automatically configured to include the default config:

```json
{
  "extends": "next"
}
```

In addition to this change:

- The feature is now under the experimental flag and requires opt-in. After testing and feedback, it will be switched to the top-level namespace and turned on by default.
- A new ESLint shareable configuration package is included that can be extended in any application with `{ extends: 'next' }`
  - This default config extends recommended rule sets from [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react), [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks), and [`eslint-plugin-next`](https://www.npmjs.com/package/@next/eslint-plugin-next)
- All rules in [`eslint-plugin-next`](https://www.npmjs.com/package/@next/eslint-plugin-next) have been modified to include actionable links that show more information to help resolve each issue
2021-04-30 11:09:07 +00: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
Gergo Tolnai
997b37ace3
Docs: add info about fallback to prerender-error (#22828) 2021-04-20 08:15:02 +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
Tim Neutkens
92e14f8d60
Update webpack5.md 2021-03-29 15:22:05 +02:00
Tim Neutkens
7da0f9c4cf
Update manifest.json 2021-03-29 15:16:10 +02:00
Tim Neutkens
46fa9b6421
Temporarily remove the automatic opt-in for webpack5 (#23497) 2021-03-29 13:42:04 +02:00
Tim Neutkens
7ecf24489a
Update static-dir-deprecated.md 2021-03-23 14:45:36 +01:00
Tim Neutkens
e52a224c21
Add manifest of error pages (#23310)
## 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

- [x] Make sure the linting passes
2021-03-23 12:53:17 +00:00
Lee Robinson
a63c64a02d
Update error message for next export and next/image. (#23061) 2021-03-15 13:01:12 -05:00
Chris Meagher
bdc20c2657
Add Azure Pipelines example to no-cache docs (#22708)
I added this in to my own pipeline to fix the no-cache error and thought it may be of use to others.
2021-03-03 09:47:19 +00:00
Azeez Lukman
00d453d74b
expanded on No Router Instance (#21248)
Added more detailed explanation of why there is no router instance, and other ways to fix the error
2021-01-26 10:27:53 +00:00
Tobias Koppers
9c4d368459
use webpack resolve api to resolve in externals config (#21205) 2021-01-17 20:02:20 +01:00
Gerald Monaco
cd5ea7db1f
Bump minimum suggested React version (#21046)
* Upgrade React version warning

* Fix font/stylesheet plugin

* Fix size-limit tests

* Fix build-output test

* Add tests for React 16

* Fix react-dom version
2021-01-14 22:29:57 -05:00
Lee Robinson
dc87a8436b
Update redirected or broken Vercel docs links. (#21119) 2021-01-14 15:37:21 +00:00
JJ Kasper
9caca2784c
Add proper error when conflicting paths are detected (#20918)
This helps catch conflicting paths returned from `getStaticPaths` with a friendly error

<details>

<summary>
Preview of error
</summary>


<img width="962" alt="Screen Shot 2021-01-08 at 5 03 04 PM" src="https://user-images.githubusercontent.com/22380829/104074719-6e481100-51d6-11eb-9397-938aee3ae30b.png">
<img width="962" alt="Screen Shot 2021-01-08 at 5 03 41 PM" src="https://user-images.githubusercontent.com/22380829/104074722-6f793e00-51d6-11eb-90f6-7cdf9882bf00.png">

</details>




Closes: https://github.com/vercel/next.js/issues/19527
2021-01-11 20:50:17 +00:00
Tim Neutkens
4dc077956d
Error when exporting to static directory (#20969)
Fixes #20408
Fixes #20925
2021-01-11 13:34:58 +00:00
Luc Leray
b442acbe1c
Replace zeit/next.js with vercel/next.js (#20849) 2021-01-07 08:41:04 -05:00
Jeremy Balog
bb05e42698
Fix typo in error markdown (#20825) 2021-01-07 10:22:43 +01:00
JJ Kasper
8b803d79a9
Update error when internal href and external as are used (#20658)
* Update error when internal href and external as are used

* Update to handle error outside invariant

* Update err.sh components
2021-01-01 12:14:42 -06:00
JJ Kasper
c93c9fcc78
Add error for invalid webpack 5 version (#20558)
Closes: https://github.com/vercel/next.js/issues/20545
2020-12-29 04:43:57 +00:00
Tim Neutkens
c792317295
Clear up production build missing message for next start and next export (#19777)
Adds an err.sh link to the production build missing message. Also clears up `valid` as `production`.

Also fixes an edge case where an unhelpful error would be thrown because we checked for `.next` instead of `.next/BUILD_ID`

Added the out directory location as the list line during export to make sure people know where the files are output. 

Fixes #19778
Fixes #19788
2020-12-08 15:16:56 +00:00
Jeff Escalante
b86a1731e1
Error Message Clarity (#16052)
* make the error message more clear if webpack config comes back undefined

* Update check and add test

* bump

* Update build-output test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-12-01 15:58:52 -06:00
Laurent Meyer
6095119970
Typo (#19475) 2020-11-24 14:21:32 +00:00
JJ Kasper
9f6d5b14df
Add test and errsh for mixed notFound/redirect error (#19076)
This ensures the mixed `notFound`/`redirect` error is shown correctly and adds an err.sh for the error. 

Closes: https://github.com/vercel/next.js/issues/18727
2020-11-11 22:02:11 +00:00
Steven
917d594ca8
Print error during next export with default image loader (#19032)
Fixes #18356
2020-11-11 15:46:48 +00:00
Gerald Monaco
80671273ca
Revert "Remove next-head-count (#16758)" (#18713)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-11-10 16:35:47 -05:00
Steven
2b94b1eea6
Update default widths configuration to handle 2x/3x DPI (#18717)
- Update default `deviceSizes`
- Add default `imageSizes`
- Use `layout` value to determine which `srcset` to use

Fixes #18420 
Closes #18714
2020-11-03 02:12:46 +00:00
Lukáš Huvar
a6759c62ad
docs: fix missing comma in invalid redirect gssp (#18580)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-10-31 23:37:06 -04:00
Steven
b7daae418b
Update install-sharp.md (#18508)
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
2020-10-30 10:56:11 -04:00
JJ Kasper
8b4d6246f3
Add err.sh for i18n config errors (#18425)
This adds an err.sh with info that can help when tracking down errors from invalid i18n config in next.config.js
2020-10-29 03:48:24 +00:00
JJ Kasper
e20dba2cf0
Add err.sh for image config errors (#18424)
* Add err.sh for image config errors

* Apply suggestions from code review

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

Co-authored-by: Steven <steven@ceriously.com>
2020-10-28 20:53:58 -05:00
JJ Kasper
27f56eb325
Add err.sh for missing images domain (#18325)
* Add err.sh for missing images domain

* Apply suggestions from code review

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

* Update test

Co-authored-by: Steven <steven@ceriously.com>
2020-10-27 16:55:21 -05:00
Steven
80bf81a3cf
Move sharp to optionalDependencies (#18068)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-10-21 12:21:42 +02:00
Steven
d3741d5ec5
Add support for Image Optimizer (#17749)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-10-16 13:10:01 +02:00
JJ Kasper
782b7e48ec
Add warning when exporting with custom routes (#17538)
This adds a warning when `next export` and custom routes are defined  outside of a platform that supports them since they won't be applied anymore.
2020-10-05 07:11:06 +00:00
Joe Haddad
c6ff918777
Update no-document-viewport-meta.md 2020-09-21 21:31:51 -04:00
Sam Dornan
0c4022e419
Fix invalid href error message (#17183) 2020-09-18 15:50:02 +00:00
Joe Haddad
9adf3bb637
Improve Document Component Error (#17047) 2020-09-12 13:39:16 -04:00
JJ Kasper
47d983f71f
Add error when href interpolation fails (#16946)
This adds an error when interpolation fails to make sure invalid `href`s aren't accidentally used and an invalid URL is built. 

Closes: https://github.com/vercel/next.js/issues/16944
2020-09-10 20:05:02 +00:00
Gerald Monaco
039eb817e1
Remove next-head-count (#16758)
Removes `next-head-count`, improving support for 3rd party libraries that insert or append new elements to `<head>`.

---

This is more or less what a solution with a `data-` attribute would look like, except that instead of directly searching for elements with that attribute, we serialize the elements expected in `<head>` and then find them/assume ownership of them during initialization (in a manner similar to React's reconciliation) based on their properties.

There are two main assumptions here:
1. Content is served with compression, so duplicate serialization of e.g. inline script or style tags doesn't have a meaningful impact. Storing a hash would be a potential optimization.
2. 3rd party libraries primarily only insert new, unique elements to head. Libraries trying to actively manage elements that overlap with those that Next.js claims ownership of will still be unsupported.

The reason for this roundabout approach is that I'd really like to avoid `data-` if possible, for maximum compatibility. Implicitly adding an attribute could be a breaking change for some class of tools or crawlers and makes it otherwise impossible to insert raw HTML into `<head>`. Adding an unexpected attribute is why the original `class="next-head"` approach was problematic in the first place!

That said, while I don't expect this to be more problematic than `next-head-count` (anything that would break in this new model also should have broken in the old model), if that does end up being the case, it might make sense to just bite the bullet.

Fixes #11012
Closes #16707

---

cc @Timer @timneutkens
2020-09-09 01:41:04 +00:00
JJ Kasper
bc80fb4fb2
Add handling for redirects from getStaticProps/getServerSideProps (#16642)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-09-08 09:23:21 +02:00
JJ Kasper
a7550bf1d7
Add error when document component isn't rendered (#16459)
If a custom `_document` is added but not all of the expected document components are rendered it can cause unintended errors as noticed in https://github.com/vercel/next.js/issues/10219 so this adds detecting when one of the expected document components isn't rendered and shows an error. 

Closes: https://github.com/vercel/next.js/issues/10219
2020-08-24 02:42:51 +00:00
Joe Haddad
fc98c13a2e
Warn on duplicate Sass deps (#16398)
Fixes #13953
2020-08-20 16:05:29 +00:00
Kevin Mårtensson
aa4b87e357
Handle cases where config is exported after its declaration (#16211)
AMP will still not work correctly when switching between non-AMP and AMP pages in development mode because of https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/plugins/next-page-config.ts#L116-L120.

Fixes #15704.
2020-08-17 17:24:18 +00:00
Joe Haddad
882288b532
Warn when Fast Refresh is disabled (React <16.10) (#15931) 2020-08-06 10:41:11 -04:00
matamatanot
2c424446b8
fix typo in export-all-in-page (#15925) 2020-08-06 00:11:11 +00:00
Joris
0fd1958ae4
Disallow re-export all exports from Next.js pages (#14325)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-05 16:21:40 -04:00
Jan Potoms
92304404a4
Disallow basePath: false for internal routes (#15837) 2020-08-04 17:50:09 +00:00
Jan Potoms
ad5c736798
Remove unused error (#15748)
Irrelevant since https://github.com/vercel/next.js/pull/15379
2020-07-31 17:29:09 +00:00
Joe Haddad
63e66ef0b0
Update gssp-export Error (#15529)
This pull request updates the `gssp-export` error for clarity.

Fixes #15527
2020-07-27 18:47:00 +00:00
Jan Potoms
e4e3ad38fd
Upgrade actions/cache to v2.1.0 (#15415) 2020-07-23 00:06:50 -04:00
Necmettin Karakaya
c2f38f2af0
[Fix] common misspelling errors (#15288)
For reference: https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-07-19 04:38:20 +00:00
Ashik Paul
4af7f6c7f5
Fixed a minor typo (#15077) 2020-07-12 18:28:24 +00:00
George Arthur
9d1d9c5235
Update prerender-error.md (#14875)
This is to further give more insight on one of the ways to fix prerendering errors especially with dynamic pages.
2020-07-10 19:01:17 +00:00
Eric Goerens
48aeb9fc4e
fixed typo in page-without-valid-component.md (#15022) 2020-07-10 18:44:17 +00: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
Yang Sun
a8d2c1ee95
modify global css import error message (#14639)
Fixes #14464
2020-06-30 05:25:02 +00:00
JJ Kasper
61b68730f8
De-experimentalize custom-routes (#14602)
This moves the custom-routes configs outside of the experimental section to prepare them for being made stable

Fixes: https://github.com/vercel/next.js/issues/14184
2020-06-27 09:18:18 +00:00
James Mosier
435bf65784
Warn/revert custom devtool in development mode (#14285)
Warn users and revert their `devtool` when they manually change the `devtool` in development mode. For this addition, I check to ensure the `devtool` is custom (i.e. different than what is set by Next) and has a value (`false` is fine as a custom `devtool`!).

As described in [this issue (13963)](https://github.com/vercel/next.js/issues/13963), changing the `devtool` in development mode can cause issues with performance.

Fixes #13963
2020-06-24 04:15:57 +00:00
stefanprobst
279ae19c7e
docs: update links to docs site (#14305)
this updates some links to the docs site to their new location
2020-06-18 09:54:07 +00:00
Timothy
d1c16124b5
Update instances of Now to Vercel where applicable (#13760)
This pull request renames various instances of `now` to `vercel` etc. in order to match content that's being updated on the Vercel platform.
2020-06-04 14:57:17 +00:00
Todor Totev
bad376127e
Detailed error and warnings upon next() call (#13539)
**First, apologies for a second PR on the same issue but I was working on this already so I thought I'd push it and let you decide which you want to merge.**

The PR is related to [13466](https://github.com/vercel/next.js/issues/13466).

Based on my research, the error happens if the options are empty, null, or undefined. That's why I have decided that the most proper check would be using the! post-fix expression operator may assert that its operand is non-null and non-undefined. ``if (options == null)``

(Optional)
I have also added a warning, which warns the user if the passed "dev" variable is not a boolean.

It's my first PR on the "packages" part of the repo so I'd be glad to receive all kinds of critics. If you want me to change or remove anything, I'm open to suggestions.

---

Fixes #13466
2020-06-03 03:19:29 +00:00
Joe Haddad
aab1fff861
Better NODE_ENV explanation (#13476)
After #12361, I've seen a few users ask "but why".

This PR updates the err.sh link to better explain the restriction.

It also provides an alternative!
2020-05-28 09:10:22 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Karl Horky
6ca00bfe31
Remove beta label from Netlify Plugins (#13465)
Netlify Plugins are out of beta!

https://www.netlify.com/blog/2020/05/27/netlify-build-plugins-are-here/
2020-05-27 20:30:39 +00:00
JJ Kasper
e2619359ec
Add warning when reserved pages are nested (#13449)
This adds a warning when a user has nested a reserved page `_error`, `_app`, or `_document` in their pages directory since it causes it to not be picked up and used by Next.js in the expected way

x-ref: https://github.com/zeit/next.js/pull/13425

<details>
<summary>Example of warning</summary>

<img width="927" alt="Screen Shot 2020-05-27 at 10 39 09" src="https://user-images.githubusercontent.com/22380829/83042315-24276c00-a007-11ea-9dc4-cabcc93571d2.png">
</details>
2020-05-27 16:45:53 +00:00
JJ Kasper
ef422467dc
Add error when exporting pages with fallback: true (#13063) 2020-05-19 09:29:34 -04:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Tim Neutkens
313b552026
Enable .env support by default (#12911)
* Enable .env support by default

Given we've had tons of reports from various people that expected .env support to work even though they had dotenv installed already I think it's fine to enable it as a default:

Fixes #12728

* Remove old test

* Fix duplicate env loading

* Update docs

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-05-15 14:02:16 -05:00
JJ Kasper
6972a09f43
Add message when automatic dotenv loading is disabled (#12744) 2020-05-11 16:32:33 -04:00
JJ Kasper
467b65a889
Add note about HoC possibly adding GIP to _app (#12491) 2020-05-05 00:11:25 -04:00
JJ Kasper
3af0fe5cf2
Add warning for non-standard NODE_ENV value (#12361) 2020-05-04 11:21:58 -05:00
Karl Horky
ed66d14ddd
Document persisting cache with Netlify Plugin (#12242) 2020-05-02 00:24:57 -04:00
Tim Neutkens
483bd3ddda
Rename ZEIT to Vercel (#12075)
* Find/replace

* Update more URLs

* More rename

* Fix remaining examples

* More updates

* Update create-next-app

* Update remaining text

* Update

Co-authored-by: Shu Uesugi <shu@chibicode.com>
2020-04-21 11:47:12 +02:00
Bhaskar Murthy
b6f44e66f8
Add Heroku to list of cache examples (#12037) 2020-04-20 10:09:38 +02:00
JJ Kasper
20c7b5c50d
Add initial process.env stubbing for new env support (#11893)
* Add initial process.env stubbing for new env support

* Fix server process.env being stubbed in production

* bump

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-15 02:42:37 -04:00
JJ Kasper
0648c35508
Update auto export opt-out warning and err.sh (#11801) 2020-04-10 12:31:19 +02:00
Joey Tepperman
cdc7f01954
Add warning when a page is rendered without a starting / (#11418)
* Add error/warning when a page is rendered without a /

Throws an error for development and gives a warning in production

* Add tests for error when rendering without starting slash

* Update to always warn and add err.sh

* Update errors/render-no-starting-slash.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-04-06 11:54:42 -05:00
JJ Kasper
1cdc607968
Warn when user has pages/_error but no pages/404 (#11603)
* Warn when user has pages/_error but no pages/404

* Update test

* Update custom-error-no-custom-404.md

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-04-05 13:19:14 +02:00
JJ Kasper
7f8f149f99
Add error when GSSP methods are added as page component members (#11645) 2020-04-03 19:08:17 -04:00
Jan Piotrowski
845f2a98fb
make providers headlines so they become linkable (#11613)
(hopefully)
2020-04-03 09:51:46 +02:00
JJ Kasper
d8155b22ff
Add initial support for new env handling (#10525)
* Add initial support for new env config file

* Fix serverless processEnv call when no env is provided

* Add missing await for test method

* Update env config to .env.json and add dotenv loading

* ncc dotenv package

* Update type

* Update with new discussed behavior removing .env.json

* Update hot-reloader createEntrypoints

* Make sure .env is loaded before next.config.js

* Add tests for all separate .env files

* Remove comments

* Add override tests

* Add test for overriding env vars based on local environment

* Add support for .env.test

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Use chalk for env loaded message

* Remove constant as it’s not needed

* Update test

* Update errsh, taskr, and CNA template ignores

* Make sure to only consider undefined missing

* Remove old .env ignore

* Update to not populate process.env with loaded env

* Add experimental flag and add loading of global env values

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-03-26 13:32:41 +01:00
JJ Kasper
eeea53c04b
Fix warning for API routes with next export (#11330)
* Fix warning for API routes with next export

* Update warning copy
2020-03-24 13:38:22 -04:00
JJ Kasper
203f43c1fe
Add error when attempting to export GSSP page (#11154)
* Add error when attempting to export GSSP page

* Update errors/gssp-export.md

* Update errors/gssp-export.md

* Update errors/gssp-export.md

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-03-18 09:33:10 +01:00
Joe Haddad
9d9f7a5873
Improve Sass Error (#10982)
* Improve Sass Error

* test sass error massage

* use quotes

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-11 16:34:14 -04:00
JJ Kasper
fde1ce2924
Add warning when built-in CSS/SCSS support is disabled (#10942) 2020-03-10 14:29:40 -04:00
Shu Uesugi
c52c0389fd
Add params to getStaticProps on err.sh (#10751)
* Add params to getStaticProps

* Update errors/invalid-getstaticprops-value.md

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-01 15:20:28 +01:00
JJ Kasper
c9d9f1131c
Remove unstable_ prefix from new methods (#10723)
* Rename getServerProps to getServerSideProps

* Remove unstable_ prefix from new methods

* Add error when legacy methods are detected

* Add legacy methods for babel transform

* Add unstable_getServerSideProps also

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Update types import

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-27 11:57:39 -06:00
JJ Kasper
2789e7e0c2
Rename getServerProps to getServerSideProps (#10722) 2020-02-27 11:04:30 -06:00
Joe Haddad
47ff1eb95a
Ability to Disable SSG Fallback (#10701)
* Ability to Disable SSG Fallback

* Throw error when value is missing

* Fix existing tests

* Adjust error message

* Do not render fallback at build time for `fallback: false` page

* Fix existing fallback behavior

* fix build

* fix version

* fix some tests

* Fix last test

* Add docs for get static paths

* Add explicit mode tests

* test for fallback error message
2020-02-27 13:23:28 +01:00
JJ Kasper
395714a475
Update url prop handling for pages with new data methods (#10653)
* Make sure to show error when url prop is returned for a page

* Update test and handle undefined pageProps

* Handle empty props

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>

* Update tests

* Update to not add url prop for SSG/SSP pages

* Update errsh for reserved prop

* Update errsh wording some more

* Update tests and to warn instead of error

* Update reserved prop warning

* Include page in url prop warning

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-26 13:26:55 -05:00
JJ Kasper
40abd708e1
Show better error when non-array is returned from custom-routes (#10670)
* Show better error when non-array is returned from custom-routes

* bump

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-24 17:01:02 -05:00
Armand Abric
156a77409b
Fix typo in invalid getStaticPaths value example (#10657) 2020-02-24 07:16:30 -05:00
JJ Kasper
95071730b6
Add err.sh for getStaticProps error (#10619)
* Add err.sh for getStaticProps error

* Prettify error

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-21 00:45:50 -05:00
Tim Neutkens
80bdf73929 Remove extra whitespace 2020-02-20 12:29:22 +01:00
JJ Kasper
db445db790
Add err.sh for invalid getStaticPaths return value (#10605)
* Add err.sh for invalid getStaticPaths return value

* Update error link

* Apply suggestions from code review

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-02-20 10:05:49 +01:00
JJ Kasper
db90ffe1ea
Implement experimental pages/404.js for custom 404 page (#10329)
* Implement experimental pages/404.js for custom 404 page

* Make sure to show error for getInitialProps in pages/404 in dev mode also

* Update routes-manifest tests for new value

* Make sure page404 is boolean in routes-manifest

* Rename variables for consistency

* Make sure to only use 404 page for 404 error
2020-02-01 15:47:42 +01:00
JJ Kasper
afc278f567
Add support for runtimeConfigs in serverless mode (#10365)
* Add support for runtimeConfigs in serverless mode

* Update test
2020-02-01 14:24:22 +01:00
Dmitry Rybin
41d1757b4e
fix: 9919 Add warning when no config is exported from next.con… (#10228)
* fix: 9919 no exported config found

* fix: 9919 remove isolated test, add integration

* fix: 9919 add check for successfull compilation and fix warnin check

* Add test for development output

* fix: 9919 add error page and link to it in warning

* Update empty-configuration.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-01-29 09:12:30 +01:00
Joe Haddad
3f9b930815
Error on Invalid PostCSS Shape (#10244)
* Error on Invalid PostCSS Shape

* Add link to docs
2020-01-23 16:27:07 -05:00
Arek Mytych
9d7ee34d2c Add info on storing cache in GitHub Actions (#10231)
* Add info on storing cache in GitHub Actions

* Specify yaml for code formatting

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Fix wording

Co-Authored-By: Joe Haddad <timer150@gmail.com>

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-23 15:40:02 -05:00
Joe Haddad
32ded0539e
PostCSS Error When Exporting Function (#10242)
* PostCSS Error When Exporting Function

* Update postcss-function.md
2020-01-23 15:39:50 -05:00
Joe Haddad
c713741f51
Explain Ignored PostCSS Plugin (#10240) 2020-01-23 15:28:37 -05:00
Joe Haddad
945f726590
Fix Linting 2020-01-23 08:30:18 -05:00
Martin Grubinger
60e62241a8 Add Bitbucket Pipelines to errors/no-cache.md (#10229)
* Update no-cache.md: add Bitbucket Pipelines

Add section on how to setup caching for Bitbucket Pipelines

* Update no-cache.md

Change wording of referencing the next cache in bitbucket pipeline
2020-01-23 11:18:00 +01:00
Naggar
71c2354ecd fix broken link in error page (#10159)
This commit updates the link for Automatic Static Optimization page in the Documentation
2020-01-19 16:02:44 +01:00
Joe Haddad
243c038222
docs(errors): CSS Modules Imported by a Dependency (#10034) 2020-01-10 11:45:01 -05:00
Joe Haddad
dd020fb888
docs(errors): CSS Imported by a Dependency (#10032) 2020-01-10 10:40:28 -05:00
Joe Haddad
fa81a4df83 Add Links to Global CSS Error (#10031)
* Add Links to Global CSS Error

* Add Example
2020-01-10 09:31:38 -06:00
JJ Kasper
163f607160
Add parsing of route source during checking (#9787)
* Add parsing of route during checking

* Update err.sh
2019-12-19 10:48:34 -06:00
Tim Neutkens
2ba056aa20
Add check for invalid assetPrefix (#9759)
* Add check for invalid assetPrefix

* Update test/integration/invalid-config-values/test/index.test.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-12-16 16:07:03 +01:00
JJ Kasper
5cf9ef6582 [WIP] Add err.sh for prerender error (#9548) 2019-11-27 10:54:57 +01:00
JJ Kasper
ff2d28c4ff Add err.sh for invalid multi-match usage (#9498)
* Adds err.sh for multi-match error

* Fix missing apostrophe

* Update regex to catch other param names

* Add test for multi-match error

* Update test/integration/invalid-multi-match/test/index.test.js
2019-11-23 02:23:01 +01:00
Joe Haddad
4d3cca3382
Warn on No Cache in CI (#9116)
* Warn on No Cache in CI

* Bold the note lead

* Add custom clarification for netlify

* Reorder

* Add tests

* Fix detection
2019-10-18 12:40:47 -04:00
Hyeonjun (Jello)
8676b0ffd6 Update no-document-title.md (#9082) 2019-10-15 10:42:44 -05:00
Joe Haddad
58cc1d3be4
Remove static optimization from message (#9045)
* Remove static optimization from message
This check does not pertain to automatic static optimization.

Closes https://github.com/zeit/next.js/issues/9042

* Update help message
2019-10-11 10:39:38 -04:00
JJ Kasper
5b574fc778
Update to error on usage of serverRuntimeConfig with serverless (#9030)
* Update to error on usage of serverRuntimeConfig with serverless

* Add tests for errors for serverless and runtime configs

* Update docs wording
2019-10-10 16:56:38 -05:00
Bertrand Marron
a48c80415d Fix can-not-output-to-public error title (#8988) 2019-10-08 08:28:09 -05:00
JJ Kasper
28377a783b Add static directory deprecation warning (#8636)
* Add static directory warning

* Simplify migration to public directory

* Update static-dir-deprecated.md
2019-10-06 13:57:41 +02:00
JJ Kasper
e2d713f93e De-experimentalize the public/ folder (#8661)
* Remove experimental.publicDirectory config

* Error when public is set as an output dir

* Remove experimental.publicDirectory checks

* Update publicFiles checking in next build
2019-10-06 13:44:03 +02:00
Joe Haddad
c9d9ff6a8b
Informative Error for Invalid Global CSS (#8958)
* Informative Error for Invalid Global CSS
This adds a helpful error message with a (basic) err.sh link for invalid Global CSS usage.

We'll want to expand on this topic more and offer alternatives when CSS Modules support lands.

* Update expected error message
2019-10-04 11:55:18 -04:00
Joe Haddad
29c1b93c89
s/Automatic Prerendering/Automatic Static Optimization/ (#8940)
* s/Automatic Prerendering/Automatic Static Optimization/

* Update more links
2019-10-02 18:03:00 -04:00
JJ Kasper
a8e3b02236 Add src directory support (#8735)
* Add find-pages-dir

* Add support for src directory

* Add test for pages dir preference

* Update comment
2019-09-24 17:15:14 +02:00
JJ Kasper
4e9e51035e Match public files priority in dev (#8641)
* Match public files priority in dev

* Remove un-needed old public file handling

* Run public file priority test for non-dev also

* Make sure to enable publicDirectory

* Add checking for conflicting pages in dev and during build

* Add error for public dir middleware conflict

* Add err.sh for _next conflict

* Move up public dir conflict checking

* Only run _next conflict check in dev when path contains it
2019-09-16 23:06:30 +02:00
Lukáš Huvar
7863b60ef6 Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
Joe Haddad
319bc463e7
Mention Custom App GIP in UPGRADING (#8647)
This tells the user to check their custom <App> for `getInitialProps` if they previously copied the example.

This should help them leverage automatic static optimization!
2019-09-05 22:37:22 -04:00
JJ Kasper
4eb7dde490 Add err.sh for incompatible href and as (#8561)
* Add err.sh for incompatible href and as

* Add note for only showing when Link is clicked
2019-08-29 13:25:42 -04:00
Lukáš Huvar
509d160318 Normalize errors to use nextjs.org (#8518) 2019-08-26 16:00:37 +02:00
JJ Kasper
bf11421992 Add deprecation warning for App Container (#8475)
* Add deprecation warning for App Container

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Tweak for more dead-code elimination
2019-08-22 16:19:15 -04:00
JJ Kasper
be850d0353
Add warning when empty object is returned from getInitialProps (#8474)
* Add warning when empty object is returned
from getInitialProps

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Apply suggestions from code review

Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>
2019-08-22 12:06:30 -05:00
Lukáš Huvar
7e1d54cc09 Add warning for disabled minification during build (#8337)
* Add warning for disabled minification

* Adding err.sh

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Remove example

* Update packages/next/build/index.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update index.test.js
2019-08-12 23:13:12 -04:00
Natalie Marleny
06876f1be0 fix: Warn when user specifies prefetch option as true (#8233)
* Warn when user specifies prefetch option as `true`

* Update index.test.js
2019-08-12 00:26:25 -04:00
Gerald Monaco
04cf779702 Add warning for missing <Head> (#8276)
* Add warning for missing <Head>

* Update the warning to be eliminated away in production

* Update head-manager.js
2019-08-11 22:48:05 -04:00
Luis Fernando Alvarez D
36aabe05a2 Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route

* Moved the test to the export tests

* Added missing comma

* Move the API route comment

* Add comma after replace

* Show a warning instead
2019-08-12 00:37:20 +02:00
JJ Kasper
8e4509caf2 Add warning for invalid href being passed to router (#8231)
* Add warning for bad href being passed to router

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Inline invalidHref for better code elimination
2019-08-07 10:47:13 -04:00
Joe Haddad
aac5121466
Apply missing formatting (#8079)
* Reapply missing formatting

* Fix lint
2019-07-23 14:33:49 -04:00
JJ Kasper
86b6a4b6fe
Add handling for invalid page config (#7921) 2019-07-15 13:54:35 -07:00
Lukáš Huvar
2450c85e81 exportPathMap dynamic routes params fix (#7846)
* Fix dynamic page export fixes #7829

* Adding handling of unmatched path

* Remove logs

* Fix newline

* Tests

* Fix promise

* Fix amp tests

* Revert test

* Adjust error document

* Remove old argument

* Simplify export test

* Ensure page !== path for this check
2019-07-10 17:13:44 -04:00
Tim Neutkens
bb2ae41a26 Copy invalid-resolve-alias as it is being linked in the codebase 2019-07-08 14:29:19 +02:00
Tim Neutkens
18abc98257 Link invalid-resolve-alias as it is being linked in the codebase 2019-07-08 14:28:09 +02:00
Joe Haddad
6fa17b3f15
Improve automatic prerendering warning (#7759) 2019-07-05 11:57:16 -04:00
JJ Kasper
7ac8dcbec0 Add deprecation message for next/dynamic modules (#7750) 2019-07-04 23:36:53 -04:00
JJ Kasper
090a06bb2c
Add handling for invalid pages during autoExport (#7574)
* Add handling for invalid pages during autoExport

* Add err.sh link for invalid page export

* Fix typo

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
2019-06-13 17:08:19 -07:00
Tim Neutkens
3e51ddb8af
Move syntax formatting to prettier (#7454)
* Run prettier over packages/**/*.js

* Run prettier over packages/**/*.ts

* Run prettier over examples

* Remove tslint

* Run prettier over examples

* Run prettier over all markdown files

* Run prettier over json files
2019-05-29 13:57:26 +02:00
Alan Russell
e8deecd19c
Update no-document-title.md (#6832)
`router` is not needed in the scope
2019-04-09 15:37:08 -04:00
Joe Haddad
19c635175b
Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages

* Add code VSCode deleted

* Add dynamicBuildId option to __NEXT_DATA__

* Reduce amount of diff

* Make getPageFile code easier to read

* Minimize diff

* minimize diff

* Fix default value for dynamicBuildId

* Fix weird bug

* Fetch the head build id on client

* Move __selectivePageBuilding

* Add tests

* Remove _this

* Add console warning
2019-04-04 17:54:01 -04:00
JJ Kasper
9995f5d518
Add checking of react versions (#6892)
* Add checking of react versions to make sure it
meets the minimum set in peerDependencies

* Simplify react check

* Update error wording

Co-Authored-By: timneutkens <tim@timneutkens.nl>

* Add err.sh

* Update test-production circleci job name

* Add react error message to next-dev-server

* Update test for new wording
2019-04-04 16:47:17 -05:00
JJ Kasper
aac50e4501
Add error message for AMP bind syntax (#6865)
* Add error message for AMP bind syntax

* Fix custom AMP scripts getting dropped

* Add data.js to package.json to include it
in releases
2019-04-02 17:32:07 -05:00
JJ Kasper
244b0e700e
Add AMP validation on export (#6794)
* Add err.sh link and pool validation results
to wait to show error until export is finished

* Fix wording in amp-export-validation err.sh

* Update validation error message

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update ways to fix text

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update why the error occurred wording

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update wording some more

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
2019-03-26 16:21:27 -05:00
JJ Kasper
2d6a73cb66 Remove conflicting <head> tags in amp mode (#6693) 2019-03-18 12:29:31 +01:00
JJ Kasper
11a161f296 Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.

Fixes: #6681
2019-03-17 13:13:29 +01:00
JJ Kasper
a38c6cb3d9
Add err.sh link for threw undefined (#6649)
* Add err.sh link for threw undefined

* Update wording

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
2019-03-13 15:08:06 -05:00
k-kawakami
d9060f5abd Remove trailing spaces (#6547)
### changes
#### remove trailing spaces

When I was using example I noticed trailing spaces.
So, this PR removes the trailing spaces of json file, README, and others.

`examples/with-jest-typescript/src/modules/cars/Overview.tsx` also has it, but this time it did not change as tslint error occurs at commit.
2019-03-07 17:40:08 +01:00
JJ Kasper
e112df4319 Throw error when router methods are used in SSR (#6550)
* Update to use the correct router instance in withRouter so error is
thrown when router method is used during SSR

* Revert changes to with-router and add error to methods on
direct router instance

* Extend Router and override methods with error instead

* Update ServerRouter, add err.sh, and add test
2019-03-07 17:13:38 +01:00
JJ Kasper
4c35b7e704
Add warning on stalled page load possibly from too many tabs open (#6514)
* Add warning on stalled page load possibly from too many tabs open

* Add test for stalled warning

* Update onDemand pinging to close on routeChangeStart and added
warning when onDemand handler detects multiple tabs from the same
browser
2019-03-02 16:51:14 -06:00
JJ Kasper
912e45b506 Show error when router or Component are returned in _app.js (#6487)
* Show error when `router` or `Component` are returned in _app.js
getInitialProps

* Update to only show error in dev mode

* Update packages/next-server/server/render.tsx

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
2019-03-01 18:08:27 +01:00
JJ Kasper
1c1d5d01f8 Throw error when Promise is returned in next.config (#6476)
After discussion, it was decided we should throw an error when a promise is returned in `next.config.js` as this isn't supported

Fixes: #6416
2019-02-28 14:39:51 +01:00
Connor Davis
2fd397ff5a
Add error for exporting when target is not server (#6455) 2019-02-26 15:48:30 -06:00
JJ Kasper
bf69357f27 Remove onDemandEntries WebSocket server in favor of EventSource connection (#6354)
After talking with @timneutkens it was decided it'd be more streamlined to replace the onDemandEntries WebSocket with an alternative. Using the EventSource connection gives us these benefits over the WebSocket one:

- less code needed
- no extra server running
- no extra config for onDemandEntries
2019-02-19 21:58:47 +01:00
JJ Kasper
5d779a0289 Add falling back to fetch based pinging for onDemandEntries (#6310)
After discussion, I added falling back to fetch based pinging when the WebSocket fails to connect. I also added an example of how to proxy the onDemandEntries WebSocket when using a custom server. Fixes: #6296
2019-02-15 22:22:21 +01:00
Connor Davis
1e5d0908d0 Block Certain Env Keys That Are Used Internally (#6260)
Closes: #6244 

This will block the following keys:
```
NODE_.+
__.+
```

There doesn't seem to be a way to simulate a failed build or else I'd add tests for it.
2019-02-15 17:49:40 +01:00
Connor Davis
6f162b94e1 Add Error when using publicRuntimeConfig with target serverless and add buildVars (#6212)
Introduce env to next.config.js for build-time configuration
2019-02-08 14:38:18 +01:00
Connor Davis
8b24103d7f Throw Error When Running next start on Serverless Build (#6166)
Fixes #6144
2019-01-29 13:42:07 +01:00
Tim Neutkens
b3045cc7a9
Implement circular JSON err.sh link (#6149)
* Implement circular JSON err.sh link

* Add test for getInitialProps returning circular json

* Make test warn less

* Fix tests

* Add reference to original tests
2019-01-27 16:12:17 +01:00
Connor Davis
419bec0b9b Fix #5674 Append crossOrigin on the client side too, add config option for crossOrigin (#5873)
# Fixes https://github.com/zeit/next.js/issues/5674

This adds config option
```js
// next.config.js
module.exports = {
  crossOrigin: 'anonymous'
}
```
This config option is defined in the webpack Define Plugin at build.
`Head` and `NextScript` now use the config option, if it's not explicitly set on the element.
This value is now passed to Webpack so it can add it to scripts that it loads.
The value is now used in `PageLoader` (on the client) so it can add it to the scripts and links that it loads.
Using `<Head crossOrigin>` or `<NextScript crossOrigin>` is now deprecated.
2018-12-13 01:05:21 +01:00
Peter Halasz
01b34bb784 Format no-document-title description (#5803) 2018-12-03 23:04:18 +01:00
Tim Neutkens
d0dd1bc28d
Trim buildId returned from generateBuildId (#5634)
* Trim buildId returned from generateBuildId

* Pass dir to function
2018-11-12 15:57:48 +01:00
Luc
f8dfe026ec Show warning if there is a title in _document.js's Head (#5160)
* show warning if there is a title in _document.js Head

* dont loop through children in production

* only 1 loop through this.props.children 💪

* also raise warning in test env

* check for null childs
2018-09-28 00:24:12 +02:00
Tim Neutkens
400a04f487
Make warning about false positives clearer (#5079) 2018-09-03 15:13:45 +02:00
Tim Neutkens
0dd2b2aa74
Add warning for broken popstate (#5000)
* Add warning for undefined url and as coming from popstate

* Use consistent url

* Fix err.sh link in test

* Rename `inital` => `initial`
2018-08-24 12:30:27 +02:00
HaNdTriX
d1b67623f6 Throw error if getInitialProps is defined as as instance method (#4922)
* Throw error if getInitialProps is defined as as instance method

Omitting the static keyword happens pretty often. Therefore we should trigger a warning in devmode.

Closes: #4782

* Document getInitialProps error

* Add unit tests for loadGetInitialProps
2018-08-09 10:13:44 -07:00
Olivia Isaacs
91900d1172 Update "url deprecated" error docs with note re: React Dev Tools (#4652)
Fixes #4284 

Made change as discussed in #4284
2018-06-22 23:23:10 +02:00
Tim Neutkens
3ae9f877a9
Rephrase url deprecation text and add link to next-codemod (#4649)
* Rephrase url deprecation text and add link to next-codemod

* Clean up double words
2018-06-22 14:21:28 +02:00
Tim Neutkens
eca8e8f64b
Expose app.js (#4129)
* Expose pages/_app.js

* Add tests for _app and _document

* Uncomment deprecation warnings

* Add documentation for _app, improve documentation of _document

* Update docs / test for _document

* Add _document to client compiler in development

* Add missing app.js to comment

* Only warn once

* Add url-deprecated error page

* Combine tests

* Yse same message for all methods of ‘props.url’

* Update docs around _app

* Update documentation

* Quotes

* Update table of contents
2018-04-12 10:33:22 +02:00
Arunoda Susiripala
a32b22bb2d
Remove special error script handling (#3849)
* Remove special error script handling.
As a result of that, we can't detect 500 errors and buildIdMismatch via client side.

* Fix failing test cases.

* Refactor the code base.

* Remove Router.onAppUpdated
2018-02-21 23:11:25 +05:30
Jerome Fitzgerald
c92bc858f7 [refactor] poweredByHeader (#3716) (#3807)
This reverts `fb7c862` per @timneutkens

- Removes the errors/*.md associated
- Puts back `poweredByHeader` for `next.config.js`
- Reincorporates test:

X-Powered-By header
    ✓ should set it by default (3ms)
    ✓ should not set it when poweredByHeader==false (5ms)

Also tested with `yarn link` and verified.
2018-02-14 18:02:48 +01:00
Tim Neutkens
e093441bad Universal Webpack (#3578)
* Speed up next build

* Document webpack config

* Speed up next build

* Remove comment

* Add comment

* Clean up rules

* Add comments

* Run in parallel

* Push plugins seperately

* Create a new chunk for react

* Don’t uglify react since it’s already uglified. Move react to commons in development

* Use the minified version directly

* Re-add globpattern

* Move loaders into a separate variable

* Add comment linking to Dan’s explanation

* Remove dot

* Add universal webpack

* Initial dev support

* Fix linting

* Add changes from Arunoda's work

* Made next dev works.
But super slow and no HMR support.

* Fix client side hot reload

* Server side hmr

* Only in dev

* Add on-demand-entries client + hot-middleware

* Add .babelrc support

* Speed up on demand entries by running in parallel

* Serve static generated files

* Add missing config in dev

* Add sass support

* Add support for .map

* Add cssloader config and fix .jsx support

* Rename

* use same defaults as css-loader. Fix linting

* Add NoEmitErrorsPlugin

* Add clientBootstrap

* Use webpackhotmiddleware on the multi compiler

* alpha.3

* Use babel 16.2.x

* Fix reloading after error

* Remove comment

* Release 5.0.0-univeral-alpha.1

* Remove check for React 16

* Release 5.0.0-universal-alpha.2

* React hot loader v4

* Use our static file rendering machanism to serve pages.
This should work well since the file path for a page is predictable.

* Release 5.0.0-universal-alpha.3

* Remove optional loaders

* Release 5.0.0-universal-alpha.4

* Remove clientBootstrap

* Remove renderScript

* Make sure pages bundles are served correctly

* Remove unused import

* Revert to using the same code as canary

* Fix hot loader

* Release 5.0.0-universal-alpha.5

* Check if externals dir exist before applying config

* Add typescript support

* Add support for transpiling certain packages in node_modules

Thanks to @giuseppeg’s work in https://github.com/zeit/next.js/pull/3319

* Add BABEL_DISABLE_CACHE support

* Make sourcemaps in production opt-in

* Revert "Add support for transpiling certain packages in node_modules"

This reverts commit d4b1d9babfb4b9ed4f4b12d56d52dee233e862da.

In favor of a better api around this.

* Support typescript through next.config.js

* Remove comments

* Bring back commons.js calculation

* Remove unused dependencies

* Move base.config.js to webpack.js

* Make sure to only invalidate webpackDevMiddleware one after other.

* Allow babel-loder caching by default.

* Add comment about preact support

* Bring back buildir replace

* Remove obsolete plugin

* Remove build replace, speed up build

* Resolve page entries like pages/day/index.js to pages/day.js

* Add componentDidCatch back

* Compile to bundles

* Use config.distDir everywhere

* Make sure the file is an array

* Remove console.log

* Apply optimization to uglifyjs

* Add comment pointing to source

* Create entries the same way in dev and production

* Remove unused and broken pagesGlobPattern

* day/index.js is automatically turned into day.js at build time

* Remove poweredByHeader option

* Load pages with the correct path.

* Release 5.0.0-universal-alpha.6

* Make sure react-dom/server can be overwritten by module-alias

* Only add react-hot-loader babel plugin in dev

* Release 5.0.0-universal-alpha.7

* Revert tests

* Release 5.0.0-universal-alpha.10

* Make sure next/head is working properly.

* Add wepack alias for 'next' back.

* Make sure overriding className in next/head works

* Alias react too

* Add missing r

* Fragment fallback has to wrap the children

* Use min.js

* Remove css.js

* Remove wallaby.js

* Release 5.0.0-universal-alpha.11

* Resolve relative to workdir instead of next

* Make sure we touch the right file

* Resolve next modules

* Remove dotjsx removal plugins since we use webpack on the server

* Revert "Resolve relative to workdir instead of next"

This reverts commit a13f3e4ab565df9e2c9a3dfc8eb4009c0c2e02ed.

* Externalize any locally loaded module lives outside of app dir.

* Remove server aliases

* Check node_modules reliably

* Add symlink to next for tests

* Make sure dynamic imports work locally.
This is why we need it: b545b519b2/lib/MainTemplate.js (L68)
We need to have the finally clause in the above in __webpack_require__.
webpack output option strictModuleExceptionHandling does that.

* dynmaic -> dynamic

* Remove webpack-node-externals

* Make sure dynamic imports support SSR.

* Remove css support in favor of next-css

* Make sure we load path from `/` since it’s included in the path matching

* Catch when ensurepage couldn’t be fulfilled for `.js.map`

* Register require cache flusher for both client and server

* Add comment explaining this is to facilitate hot reloading

* Only load module when needed

* Remove unused modules

* Release 5.0.0-universal-alpha.12

* Only log the `found babel` message once

* Make sure ondemand entries working correctly.
Now we are just using a single instance of OnDemandEntryHandler.

* Better sourcemaps

* Release 5.0.0-universal-alpha.13

* Lock uglify version to 1.1.6

* Release 5.0.0-universal-alpha.14

* Fix a typo.

* Introduce multi-zones support for mircofrontends

* Add section on css
2018-01-30 16:44:44 +01:00
Tim Neutkens
8cd6bd3fc3
Add check for writeable directory (#3370)
* Add check for writeable directory

Followup of https://github.com/zeit/now-cli/issues/175

* Add link to docs
2017-12-02 18:13:39 +01:00