Commit graph

59 commits

Author SHA1 Message Date
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