Fixes https://github.com/vercel/next.js/issues/15595
- Updated the tailwindcss and tailwindcss-emotion examples to the latest version of tailwindcss
- Added a new `with-styled-jsx` example
- Updated the `basic-css` example to use CSS Modules instead of styled-jsx
- Added the examples to the documentation page for built-in css support
It seems like the error occurs with `next export` when building the current example.
```
$ cd examples/with-electron-typescript
$ yarn && yarn build
Error occurred prerendering page "/detail". Read more: https://err.sh/next.js/prerender-error
Error: Error for page /detail: pages with `getServerSideProps` can not be exported. See more info here: https://err.sh/next.js/gssp-export
Error: Export encountered errors on following paths:
/detail
at exportApp (/Users/kstg/src/github.com/zeit/next.js/examples/with-electron-typescript/node_modules/next/dist/export/index.js:22:1166)
error Command failed with exit code 1.
```
I changed routes to statically resolve pages generating from `pages/detail.tsx` and added `getStaticPaths` and `getStaticProps`. so then it will export as follows
```
yarn run v1.22.4
$ next build renderer && next export renderer
Creating an optimized production build...
Compiled successfully.
Automatically optimizing pages...
Page Size First Load JS
┌ ○ / 336 B 62.6 kB
├ ○ /404 2.54 kB 61.6 kB
├ ○ /about 338 B 62.6 kB
├ ● /detail/[id] 440 B 62.7 kB
├ ├ /detail/101
├ ├ /detail/102
├ ├ /detail/103
├ └ /detail/104
└ ● /initial-props 530 B 62.8 kB
+ First Load JS shared by all 59.1 kB
├ static/pages/_app.js 983 B
├ chunks/commons.9facbe.js 10.9 kB
├ chunks/framework.b76773.js 40.3 kB
├ runtime/main.800476.js 6.22 kB
└ runtime/webpack.c21266.js 746 B
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
> using build directory: /Users/kstg/src/github.com/zeit/next.js/examples/with-electron-typescript/renderer/.next
copying "static build" directory
> No "exportPathMap" found in "next.config.js". Generating map from "./pages"
launching 7 workers
Exporting (0/4)
Exporting (1/4)
Exporting (2/4)
Exporting (3/4)
Exporting (4/4)
Export successful
Done in 11.47s.
```
* Add with-sitemap Example
* Update README
* Update examples/with-sitemap/scripts/generate-sitemap.js
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-sitemap/package.json
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-sitemap/public/sitemap.xml
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update README
* Add .env Info to README
* Update examples/with-sitemap/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-sitemap/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-sitemap/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-sitemap/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update Sentry example for use with Sentry/Vercel integration
* update linting
* Update link in readme
* Update readme, add comment
* Add step about commit SHA
* Updated readme
* Use if
* dont call sentry webpack plugin w/o a commit sha present
* Update examples/with-sentry/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* update release value
* prettier readme
* Updated note
Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* MongoDB Example
* Apply suggestions from code review
* Add changes based on feedback.
* clean up code with more descriptive props
* Use MongoDB in ServerSideProps instead of separate API route
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update examples/with-mongodb/README.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
Co-authored-by: Luis Alvarez D <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
The example used an outdated version of carbon components v9.
The latest got a huge facelift, new components and a lot of optimizations.
I updated the example with carbon-components v10.
prettier --write **/*.{js,ts,tsx} does not work as intended, it never does traverse all files with js,ts,tsx extension. For it to work as intended, extension args should be wrapped in quotes like this "**/*.{js,ts,tsx}"
UPDATE I ADDED:
setUser()
AFTER REMOVING cookie IN return STATEMENT OF logout ARROW FUNCTION
There might be some cases where you do not want to redirect users after logout rather let them remain in that same page BUT let them know they have logged out by some UI changes .
For that cases you might need the 'user' hook to update when users logs out .
CURRENTLY the 'user' hook DOES NOT UPDATE AUTOMATICALLY when the user logs out .
PAGE REFRESH NEEDED to update that.
So i propose that we might add setUser() to update user so that user never returns true until user is set some value again
Sorry if I'm mixed up here. Was trying to install this and realized the folder is just `/with-emotion`. Guessing this was merged to overwrite the pre-v10 example project.
There is a bug in the cms-wordpress example due to a Wordpress plugin dependency. After running `npm install`, then either `npm run dev` or `npm run build`, the following errors appear in the console:
```shell
> cms-wordpress@1.0.0 dev /Users/jplew/Sites/projects/next.js/examples/cms-wordpress
> next
ready - started server on http://localhost:3000
info - Loaded env from /Users/jplew/Sites/projects/next.js/examples/cms-wordpress/.env.local
event - compiled successfully
event - build page: /
wait - compiling...
event - build page: /next/dist/pages/_error
event - compiled successfully
[
{
message: 'Cannot query field "name" on type "NodeWithAuthorToUserConnectionEdge". Did you mean "node"?',
extensions: { category: 'graphql' },
locations: [ [Object] ]
},
{
message: 'Cannot query field "firstName" on type "NodeWithAuthorToUserConnectionEdge".',
extensions: { category: 'graphql' },
locations: [ [Object] ]
},
{
message: 'Cannot query field "lastName" on type "NodeWithAuthorToUserConnectionEdge".',
extensions: { category: 'graphql' },
locations: [ [Object] ]
},
{
message: 'Cannot query field "avatar" on type "NodeWithAuthorToUserConnectionEdge".',
extensions: { category: 'graphql' },
locations: [ [Object] ]
}
]
Error: Failed to fetch API
at fetchAPI (webpack-internal:///./lib/api.js:31:11)
```
The reason for this is `wp-graphql` released version v0.10.0 ten days ago which introduced a number of breaking changes (https://github.com/wp-graphql/wp-graphql/releases/tag/v0.10.0). Specifically, this is the change that breaks the current example:
> - One to One relationships are now nested. For example post.author and post.featuredImage now return an edge/node instead of the node directly.
More info about this change can be found here: https://github.com/wp-graphql/wp-graphql/issues/347#issuecomment-639071772
After my changes, `npm run dev` and `npm run build` succeed without errors.
Fixes#14792Closes#14814
The project id is currently used by Sanity's image builder, which is used in a React component.
@maybac It was faster for me to create a new PR but the credit goes to you, thank you!.