- 29 May, 2020 4 commits
-
-
Tim Neutkens authored
-
Joe Haddad authored
This removes `fork-ts-checker-webpack-plugin` and instead directly calls the TypeScript API. This is approximately 10x faster. Base build: 7s (no TypeScript features enabled) - `fork-ts-checker-webpack-plugin@3.1.1`: 90s, computer sounds like an airplane - `fork-ts-checker-webpack-plugin@4.1.6`: 84s, computer did **not** sound like an airplane - `fork-ts-checker-webpack-plugin@5.0.0-alpha.14`: 90s, regressed - `npx tsc -p tsconfig.json --noEmit`: 12s (time: `18.57s user 0.97s system 169% cpu 11.525 total`) - **This PR**: 22s, expected to get better when we run this as a side-car All of these tests were run 3 times and repeat-accurate within +/- 0.5s.
-
Joe Haddad authored
This PR checks if our tests can be ran faster by disabling source maps unless they're used for the purpose of testing.
-
Joe Haddad authored
-
- 28 May, 2020 19 commits
-
-
Joe Haddad authored
This pull request refactors our TypeScript preflight check in preparation for dropping the `fork-ts-checker-webpack-plugin` plugin. This will make reviewing the subsequent PR much easier. --- There is no behavior change, so the existing test should cover this adequately.
-
Jan Potoms authored
Running ``` yarn ``` in the project while on node.js 14 results into errors with the `grpc` dependency of `firebase`. Updating `firebase` fixes that.
-
Michael Albertz authored
Resolves: https://github.com/zeit/next.js/issues/12545 This PR adds an example which show how to bundle and use WebWorkers in a next.js app. The issue mentions Typescript, but adding typescript to the example should be fairly simple by following the documentation and seems out of scope for a web-worker example.
-
Joe Haddad authored
By default, webpack will proceed to run loaders and plugins on all files, even after an error has been encountered during the build process. This means you might need to wait minutes to see a syntax error encountered in one of your source files. This PR fixes that.
-
Aral Roca Gomez authored
Fix a typo.
-
Prateek Bhatnagar authored
-
Rubén Sospedra authored
Motivated by the need to deploy static sites while having a good i18n support¹ ² @vinissimus developed [next-translate](https://github.com/vinissimus/next-translate). Here's the example ;) References: 1. https://github.com/vercel/next.js/discussions/10651 2. https://github.com/vercel/next.js/pull/12535#issuecomment-624317275
-
Mathis Chenuet authored
The current example doesn't work if one try to reproduce it with a recent version of http-proxy-middleware.
-
Tim Neutkens authored
-
Joe Haddad authored
Co-authored-by:kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
Joe Haddad authored
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!
-
Joe Haddad authored
This adds a lint rule to ensure we don't import dev dependencies by accident.
-
Chandu authored
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed.
-
Joe Haddad authored
-
Joe Haddad authored
-
Joe Haddad authored
-
Joe Haddad authored
As reported here: https://twitter.com/vvoyer/status/1246913957899763712?s=21
-
Joe Haddad authored
-
Joe Haddad authored
-
- 27 May, 2020 17 commits
-
-
Joe Haddad authored
-
Jimmy Merritello authored
### Add dynamic routes to _with-route-as-modal_ example This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) to the **with-route-as-modal** example. This change might also clear up some confusion here on https://github.com/zeit/next.js/issues/11971 Additionally this PR makes sure each modal route is also a modal **page.** This is an important distinction and makes sure the experience is the same should the URL (route) be shared as a link. In other words, `index.js` need not be the only "entrypoint" to browsing the website. With the additions in this PR, each post page is an actual page, so if you were to share the link for **Post 3** you'd get this: <img src="https://user-images.githubusercontent.com/7191639/82058282-25ad7780-968a-11ea-94f1-9b4a36abccf9.png" width="200px" /> (clickable outer region brings you back to the 'gallery') **Update:** I have also included the `pathname` to signal the difference in which page component is rendered Rather than this (previously): <img src="https://user-images.githubusercontent.com/7191639/82058199-0878a900-968a-11ea-97d2-e9e20c9267fc.png" width="200px" /> I have used a similar approach [here
🔗 ](https://hashiconf.com/digital-june/schedule/the-hitchhikers-guide-to-terraform-your-infrastructure) -
Karl Horky authored
Netlify Plugins are out of beta! https://www.netlify.com/blog/2020/05/27/netlify-build-plugins-are-here/
-
Manu Schiller authored
This adds `InferredStaticProps` and `InferredServerSideProps` to the typings. - [x] add types for type inference - [x] add explanation to docs - [ ] tests - are there any?  ### What does it do: As an alternative to declaring your Types manually with: ```typescript type Props = { posts: Post[] } export const getStaticProps: GetStaticProps<Props> = () => ({ posts: await fetchMyPosts(), }) export const MyComponent(props: Props) =>( // ... ); ``` we can now also infer the prop types with ```typescript export const getStaticProps = () => ({ // given fetchMyPosts() returns type Post[] posts: await fetchMyPosts(), }) export const MyComponent(props: InferredStaticProps<typeof getStaticProps>) =>( // props.posts will be of type Post[] ); ``` ### help / review wanted - [ ] I am no typescript expert. Although the solution works as intended for me, someone with more knowledge could probably improve the types. Any edge cases I missed? - [ ] are there any tests I should modify/ add?
-
Joe Haddad authored
This pull request updates our TypeScript verification process to not wipe out potentially vital user comments. Introducing a prompt process was mostly a side effect of users wanting to keep comments. There's no reason we really need this prompt, as answering no would refuse to boot the Next.js server anyway. --- Fixes #8128 Closes #11440
-
Stephen Cefali authored
Co-authored-by:Joe Haddad <joe.haddad@zeit.co>
-
JJ Kasper authored
Co-authored-by:Joe Haddad <joe.haddad@zeit.co>
-
JJ Kasper authored
-
Jacob D. Castro authored
There was no period before `jsx` in the list of file types for pages. I added the period for consistency.
-
JJ Kasper authored
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>
-
Joe Haddad authored
Observed here: https://github.com/zeit/next.js/pull/13434#issuecomment-634566450
-
TodorTotev authored
1. I updated all the packages. 2. Refactored the home component from class to functional 3. Example now uses getServerSideProps instead of getInitialProps
-
Maxi Gimenez authored
-
Benjamin Pearson authored
## What An example to show how you can create a static generated build of Next.js (using the new `getStaticProps` and `getStaticPaths` functions) with data fetched from a local GraphQL schema. The same schema is used to host a GraphQL endpoint using the API Route `/api/graphql`. ## Why I was setting up a static hosted website whereby data is stored in a set of local JSON files (pulled from a backend server at build time). I wanted to consume the content using the developer benefits that GraphQL provides and using a consistent interface the GraphQL API consumers would be using. Within my page components I initially made GraphQL `fetch` calls to the locally running `/api/graphql` endpoint which worked well with `npm run dev`, however when it came to `npm run build` that endpoint was inaccessible (I tried both VERCEL_URL and localhost:3000) - which is now understandable given I read further the "[Write server-side code directly](https://nextjs.org/docs/basic-features/data-fetching#write-server-side-code-directly)" documentation. This example may or may not be useful for others so please feel free to close, but I thought I would contribute incase it assisted others. ## Related Discussions It looks as though this PR may help with some of the following discussions: - https://github.com/zeit/next.js/discussions/12785 - https://github.com/zeit/next.js/discussions/10946 - https://github.com/zeit/next.js/discussions/12182 - https://github.com/zeit/next.js/discussions/11285 ## Related Examples The end solution for this PR was a combination of web discussions and seeing the `api-routes-graphql` example. Perhaps this PR should just update that example to use the new methods? Or maybe it is worth having both? - https://github.com/zeit/next.js/blob/canary/examples/examples/api-routes-graphql This is also similar to this example, although that example has more code in order to provide isomorphic Apollo Client for client side code use. - https://github.com/zeit/next.js/blob/canary/examples/api-routes-apollo-server-and-client ## Errors Recieved I've included the below errors as they are the ones I faced when figuring out the end solution. These may just help with SEO for others googling the same issue. ### Error when trying to use localhost:3000 ``` > Build error occurred { FetchError: request to http://localhost:3000/api/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:3000 at ClientRequest.<anonymous> (/vercel/7cf60e2b/.next/serverless/pages/content.js:1999:147829) at ClientRequest.emit (events.js:198:13) at Socket.socketErrorListener (_http_client.js:401:9) at Socket.emit (events.js:198:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at process._tickCallback (internal/process/next_tick.js:63:19) type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED' } ``` ### Error when trying to use VERCEL_URL ``` > Build error occurred { FetchError: invalid json response body at https://vercel.com/login?next=%2Fdeployments%2Fprojectnamehere.now.sh%3Fhost%3Dprojectnamehere.now.sh%26redirect%3D1%26section%3D reason: Unexpected token < in JSON at position 0 at /vercel/3d91c11/node_modules/next/dist/compiled/node-fetch/index.js:1:133590 at process._tickCallback (internal/process/next_tick.js:68:7) type: 'invalid-json' } ```
-
JJ Kasper authored
This makes sure we don't duplicate the `/` route or any others while exporting with `exportTrailingSlash` enabled. We do still output `404.html` with `exportTrailingSlash` enabled in case anyone was relying on this file being present. Fixes: https://github.com/zeit/next.js/issues/11008
-
JJ Kasper authored
This fixes an edge case where an application can seemingly randomly be opted out of the automatic static optimization from having an `_error` file that isn't directly nested under the `pages` folder e.g. `pages/hello/_error.js`. Since in serverless mode we use the `_app` export from the first serverless page, if this `_error.js` file is used to check for custom `getIniitalProps` in `_app` and the `_error.js` page had a custom `getInitialProps` itself it would cause the check to fail opting the application out of the static optimization. This fixes it by having the check be explicit instead of relying on the bundle name and it also adds regression tests for this. It might be good to also add a warning when `_error` or `_app` are not directly nested under the pages folder in a follow up PR
-
TodorTotev authored
**Affected examples** with-segment-analytics with-slate with-portals-ssr ( _with-portals-ssr is based on a package not being updated in the last year_) with-videojs with-next-page-transitions with-firebase-cloud-messaging with-dynamic-app-layout with-dynamic-import with-next-transition with-carbon-components with-cerebral with-custom-babel-config Here and there I have removed some redundant imports as well. I believe with this PR, there are only 1 or 2 examples left using class-based components. If by any chance you find any, let me know and I'll refactor them too. If you don't like anything or you want me to change something, please let me know. **If there is anything else you'd like me to help with, I would be honored to assist.**
-