* Fix for locale.split is not a function.
Following from https://github.com/zeit/next.js/pull/5488
- Renamed languages to supportedLanguages
- Firstly, accept languages based on supportedLanguages
- And finally, accept a single language, if it returns false, the default of 'en' is used.
I looked at the navigator library, which is used by 'accept', this should be a more solid solution, since we can now know that `const locale` is always a string.
// Before (Sometimes returns an array as `const local`)
const locale = accept.language(languages) || 'en'
// After (Always returns a string)
const locale = accept.language(accept.languages(supportedLanguages)) || 'en';
* Update server.js
Update variable name.
In this example, we can:
- `QueryRenderer` SSR
- caching the data
- use the feature of `react-relay-network-modern` which is the powerful tool for `relay-modern`
I copy the example `with-relay-modern`, but I just modified the code. Some detail are not modified.
If you think this example is needed, I will fix those. Otherwise, close this **PR** to let me know this example is not needed.
- The with-firebase-auth example won't run unless a database with proper rules is created first.
- Add a small error callback to addDbListener to help with debugging if someone's database connection doesn't work.
On the server `props.initialMobxState` received by the `constructor` is a fully functioning mobx store that was instantiated by `getInitialProps()` only a few ticks earlier.
Thus, creating a new instance is unneccessary.
In the browser, however, `props.initialMobxState` is a hydrated plain object and thus the store needs to be initialized.
Current with-ant-design-less example has some problems.
- Upgrade next7, console found a 404 error.
![](https://user-gold-cdn.xitu.io/2018/11/11/167015fb80017e79?w=2606&h=1000&f=jpeg&s=124801)
> After upgrade next7, .next folder didn't find /static/style.css and there is /static/css/style.chunk.css.
- The /_next/static/style.css link don't need be placed in the <Head> tag. The style.chunk.css file will be add in the head tag automatically after build.
- The project with more pages include _app.js, _document.js...the antd-custom.less will not work well.
> The solution is use `modifyVars` of `lessLoaderOptions`. It work well in my project~
Instead of bundling `postcss-cli` we can now make use of `@zeit/with-css`.
This also means we can get rid of the `<style>` import and concurrent build step for css. 🎉
- use `enhanceApp` so that styled-components used in _app.js are server rendered
- call parent getInitialProps, fixes#5629
- return `styles`, making the render() method obsolete.
cc @mxstbr @probablyup
I spent far too much time fiddling with this example project before realizing it contained a bug in the store initialization logic and it was a bit more complex than it needed to be.
* The custom server was not needed
* The store-initialization did effectively the same thing twice for no reason
* And wrapping MyApp component in a HOC was wholly unnecessary indirection
My changes are split into four discrete commits for clarity.
* added example for using typings-for-css-modules-loader
* Update examples/with-typings-for-css-modules/README.md
* Update examples/with-typings-for-css-modules/README.md
* Update examples/with-typings-for-css-modules/next.config.js
- Looks like no other example provides a link to a hosted demo
- There is the "Deploy to now" badge, so it can be deployed on demand when needed
- The link is broken anyway
- Probably any example hosted by an individual contributor sooner or later will be cleaned up, doesn't feel like a reliable way to provide a live demo
package accept returns false if can't find language in offered list of languages, then later on
bool is attempted to be split, and app crashes in prod & dev
Docker Multistage
* Remove `devDependencies` from `./node_modules`
in `builder` for faster copy on `base` init
* Added `isomorphic-unfetch` to show it not
being copied over to `base`.
* `isomorphic-fetch` will still show from `next`
I successfully deployed this example with `now` and `now --public` (I am on premium plan).
Did this before deploy
```sh
$ cp Dockerfile.multistage Dockerfile
```