There's an edge case @timothyis is running into, this will show exactly what files are missing.
I currently can't reproduce, so this is a first step at providing better error messages
The current canary version shows the following warning in development mode:
```log
Warning: Each child in an array or iterator should have a unique "key" prop. See https://fb.me/react-warning-keys for more information.
in script
in NextScript
in body
in html
in Document
```
This PR adds proper keys to the devFiles on the server.
Related https://github.com/zeit/next.js/pull/4954
As reported by @ranyitz the links in the documentation about ['What syntactic features are transpiled? How do I change them?'](https://github.com/zeit/next.js#faq) are broken.
I updated the links and the text to reflect the latest changes.
Closes#4974
Related eb74ff4bf9
Running the [with-jest](https://github.com/zeit/next.js/tree/canary/examples/with-jest) example results in the following error:
```log
FAIL __tests__/index.test.js
● Test suite failed to run
SecurityError: localStorage is not available for opaque origins
at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
at Array.forEach (<anonymous>)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.943s
Ran all test suites.
error Command failed with exit code 1.
```
Upgrading the dependencies (jest) to the latest version helps!
[More info](https://github.com/jsdom/jsdom/issues/2304)
Related #4776
* Implement autodllplugin
* Add flow-typed for autodll-webpack-plugin
* Improve onClick tests
* Make third test pass
* Make sure DLL bundle is loaded without async
* Add nonce
* Fix windows DLL path
Following https://github.com/zeit/next.js/pull/4950
Fix https://github.com/zeit/next.js/issues/4716
I'm not sure to understand this part, though :
> Note: in order to programmatically change the route without triggering navigation and component-fetching, use `props.url.push` and `props.url.replace` within a component
Is there a difference between :
```jsx
export default () => <a onClick={() => Router.push('/about')}>About</a>
```
and
```jsx
export default withRouter(
() => <a onClick={() => props.router.push('/about')}>About</a>
)
```
?
* replace componentWillReceiveProps by componentDidUpdate
* replace props.url by withRouter HOC
* fix deprecated `props.url` in with-shallow-routing example
- [x] Add unit test
- [x] Allow to get the display name of a native component (e.g.: `div`) without throwing
- [ ] Remove displayName in production mode
Fixes#4691Fixes#4614
This PR gives path to https://github.com/zeit/next-plugins/pull/242
I did not add or remove `^` near dependency versions in package.json files. However, I don't exclude that some changes can be made given that rc is more stable than beta.
Changes:
* Split `Header` component trough `_document.js` and `_app.js`
* Attached Router events with a way described in the [documentation](https://github.com/zeit/next.js#router-events) (though in the documentation is says it should be `Router.events.on` while I managed to get it working only by `Router.router.events.on` and I had to place it inside `componentDidMount`)
`<Container>` does not receive any property. There is no way the *scrollToHash* logic can work right now. I believe it's a regression. It was working fine at some point. I'm sorry, I'm too lazy to add a test.
This fix was tested on Material-UI 👌.
This bug reproduction is the following:
As soon as you want to transition to a new page with a hash. The scroll doesn't change.
- start on pageA
- you scrollTop to 100
- you move to pageB#hash
- you stay at scrollTop 100, but #hash is at scrollTop 400.
* 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
## Issue
Running [examples/with-custom-babel-config](https://github.com/zeit/next.js/tree/canary/examples/with-custom-babel-config) will result in the following error message:
```
./pages/index.js
Module build failed (from /some_path/next.js/dist/build/webpack/loaders/next-babel-loader.js):
Error: [BABEL] /some_path/next.js/examples/with-custom-babel-config/pages/index.js:
As of v7.0.0-beta.55, we've removed Babel's Stage presets.
Please consider reading our blog post on this decision at
https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
for more details. TL;DR is that it's more beneficial in the
long run to explicitly add which proposals to use.
...
```
## Explanation
Babel removed Babel's Stage presets on July 27, 2018.
More info: https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
## Solution
I've updated the example so ist just uses the babel plugin it actually needs.
## Related
Closes: #4772
## Context
When upgrading to Next.js 6.1.1-canary.4 and using the `emit-file-loader` included in Next.js, the following error is thrown:
```bash
error in ./src/graveyard/pages/_app.scss
Module build failed (from ../node_modules/next/dist/build/webpack/loaders/emit-file-loader.js):
TypeError: Cannot read property 'context' of undefined
at Object.module.exports (~/project-root/node_modules/next/dist/build/webpack/load
ers/emit-file-loader.js:27:68)
@ ./src/pages/_app.js 35:0-53 156:17-26 157:13-22
@ multi ./pages/_app.js
```
`next.config.js` (shortened):
```js
module.exports = {
webpack: (config, { dev }) => {
config.module.rules.push({
test: /\.scss$/,
use: [
{
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext].js'
}
},
{
loader: 'babel-loader',
options: {
babelrc: false,
extends: path.resolve(__dirname, './src/.babelrc')
}
},
'styled-jsx-css-loader',
{ loader: 'postcss-loader', options: { sourceMap: dev } },
{
loader: 'sass-loader',
options: {
sourceMap: dev
}
}
]
});
return config;
}
};
```
## Suggested Fix
A quick Google search brought me to a [related issue in `webpack-loader`](https://github.com/webpack-contrib/worker-loader/issues/125). As pointed out in the [Webpack docs](https://webpack.js.org/api/loaders/#this-rootcontext):
> Starting with webpack 4, the formerly `this.options.context` is provided as `this.rootContext`.
This PR makes this change while maintaining backward compatibility.
## System information
Next.js: 6.1.1-canary.4
Node: v9.3.0