The experimental modern mode runs the type checking plugin twice, which **occasionally** suffers from a race condition that hangs the build.
This PR fixes type checking to only be run once.
While this test cannot 100% reproduce/capture the race condition, I don't feel strongly about the test case:
- We're planning on eliminating this type checking plugin ASAP (for a faster alternative)
- Modern mode implementation as-is will probably go away with webpack 5
Closes#9990 by collecting all paths with errors during `next export` and reporting them sorted in the error summary at the end.
It will produce an output similar to:
```
Error: Export encountered errors on following paths:
/nested/page
/page
/page-1
/page-10
/page-11
/page-12
/page-13
/page-2
/page-3
/page-4
/page-5
/page-6
/page-7
/page-8
/page-9
at _default (/app/next.js/packages/next/dist/export/index.js:19:788)
at process._tickCallback (internal/process/next_tick.js:68:7)
```
I tested the output with the `handle-export-errors` integration test suite, but I'm not sure how to gracefully test this added output.
I thought of collecting all page source files with [recursiveReaddirSync](2ba352da39/packages/next/next-server/server/lib/recursive-readdir-sync.ts) but it seems I can't import it in js test files:
```
SyntaxError: /app/next.js/packages/next/next-server/server/lib/recursive-readdir-sync.ts: Unexpected token, expected "," (11:5)
9 | */
10 | export function recursiveReadDirSync(
> 11 | dir: string,
| ^
12 | arr: string[] = [],
13 | rootDir = dir
14 | ): string[] {
```
The test itself could look like:
```js
it('Reports failing paths', async () => {
const { stderr } = await nextBuild(appDir, [], {
stdout: true,
stderr: true,
})
const pages = []
// collect pages to be ['/page', '/page-1', ... etc.]
pages.forEach(page => {
expect(stderr).toContain(page)
})
})
```
As discussed this adds bundling of `.env` files in `serverless` mode so that the environment values are also available when deploying with this target
closes: https://github.com/zeit/next.js/issues/13332
fix#12136
I add a prompt if there is an error when trying to download example files.
Maybe could be better to add an error class and in create-app.ts on every "console.error" trow a new Exception and manage it in catch. What you think ? 👯
Per https://github.com/zeit/next.js/issues/12964
* with-ant-design
* with-dynamic-import
* with-iron-session
* with-monaco-editor
* with-next-page-transitions
* with-react-with-styles
* with-style-sheet
* with-why-did-you-render
Tested each example, working as intended, no additional issues presented
This is purely adding types except for the line:
```js
params = getRouteMatcher(getRouteRegex(page))(path) || undefined
```
Also added a couple of `@ts-ignore` as to avoid having to make any more functional changes
Changed the URLs inside the Monaco Editor Example: https://github.com/zeit/next.js/tree/canary/examples/with-monaco-editor
Converted the worker URL to start with the base URL.
The reason is if you use the Monaco example anywhere but in the main `pages` folder, it won't work since it uses a relative URL instead.
For example if we'll move the code to `pages/room/index.js` it won't work since it will try to search for the files inside `room/_next/_static/` instead of `_next/_static/`.
The base URL I added fixes the problem.
* set up with-ts-eslint-jest example app
* eslint ignore new app bc it has a conflicting eslintrc
* make eslint + husky setup manual
* clarify app README setup notes
* move page tests out of pages/ dir
* Simplifying configs
* extend "prettier"
* format fix
* Updated rules
* Added husky configs and removed debug option
* Removed notes and configuration
* Updated pages
* Added links to readme
* Added example to .prettierignore
* Updated snap
* Make the lint work
Co-authored-by: Luis Alvarez D <luis@vercel.com>
Related to [11014](https://github.com/zeit/next.js/issues/11014)
First and most important, removed the getInitialProps and used getStaticProps.
Then, I refactored Counter, DataList and Examples components.
I have refactored them from class-based components to functional. Also in each component the redux implementation was refactored using the new hooks API, which resulted in ~40% less code.
If you want me to change anything or you are not satisfied with any given change, I'm open to suggestions.
Related to [11014](https://github.com/zeit/next.js/issues/11014)
1. I have changed the component from class to functional.
2. I have removed the getInitialProps and used getStaticProps instead.
3. I have removed the redundant connect to redux @ the index page, due to the fact that now we can dispatch the action with the required hook.
If you want me to change anything or you are not satisfied with any given change, I'm open to suggestions.
Related to [11014](https://github.com/zeit/next.js/issues/11014)
Upgraded all the packages from package.json, removed the saga-wrapper package since it is totally outdated to today's use.
I have refactored the whole example using the new API of the next-redux-wrapper package, using their new support of "getStaticProps".
All of the class components were converted to functional, using the new redux hooks API.
If you want me to change anything or you are not satisfied with any given change, I'm open to suggestions.
Next is currently removing useful information from the PnP error messages.
Before:
```
Module not found: Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies
```
After:
```
Module not found: Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies
Required package: foo (via "foo/components/Avatar")
Required by: /home/arcanis/foo/bar.tsx
```
This addresses #11910 in which `-e default` was not working because there was no example with the name `default`. This PR checks if a user inputted `default` as the example argument for `create-next-app` and if so it will use the local `default` template in the create-next-app directory.
Closes#11910
This waits for the render to be committed to DOM before we render the route change complete event (no longer sync in new React).
We have tests that ensure this resolves.
---
Closes#12938
* Update debugging docs
* typo
* Update docs/debugging.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Update docs/debugging.md
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
* Clarify
* Move to advanced features
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
This PR adds support for prepending sass code before the actual entry file.
It's common for developers to import their sass mixins and variables once on their project config so they don't need to import them on every file that requires it. Frameworks like gatsby and nuxt.js already support that handy feature.
The way it works is:
```
/// next.config.js
module.exports = {
experimental: {
sassOptions: {
prependData: `
/// Scss code that you want to be
/// prepended to every single scss file.
`,
},
},
}
```
Fixes#11617 and duplicates
This new documentation page explains how to debug your backend and frontend code in Chrome DevTools/VS Code. This works perfectly with full source map support for both Node.js and React code.
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* yarn create next-app
* create an upload show page
* create upload page to handle in-progress upload and asset when it is ready
* move things to a layout component
* add some button styling
* poll for updates intelligently by dynamically setting refreshInterval on SWR hook
* better title
* edit gitignore, add MIT license use next 'latest'
based on feedback from https://github.com/zeit/next.js/pull/12723
* add some messages and spinner to make this a little nicer
* update README with environment variables info and Mux account info
* add .now to gitignore
* cleaner uploading state - redirect to /v/:playback_id when complete
* hardset image width in footer
* remove unused styles
* adjust title font size on mobile and adjust footer height on mobile
* use upchunk 1.0.8 so we don't have to dynamically load it
* cleaner error message handling
* fix brief error from returning Router on the render
* yarn lint-fix
* update README with note about .env.local
* add min height so the layout doesn't shift after selecting a file
* set poster attribute at video element
* use getStaticProps and fallback:true to render meta tags for social sharing
* create a pages/asset/:id route that we can be on while in the preparing state
* add copy about Mux, add twitter share widget
* add flash message about video ready for playback
* call it pre-rendered instead of server-side rendered
* pre-rendering, not server-side rendering
* Next.js not NextJS
* handle asset creation errors in the UI
* call hls.destroy() when the component is unmounted
* Updated readme and renamed .env.local
* Updated description
* add suggested patch with links to source code https://github.com/zeit/next.js/pull/13120#issuecomment-632858572
* Added vercel.json
* Updated some links
* Removed Prerequisites
Co-authored-by: Luis Alvarez <luis@vercel.com>
* Modified nextjs config so that it works with all types of fonts and images.
* Update next.config.js
* Fix code
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Currently failing because `withStyles` can't read the interface from context:
```
Unhandled Runtime Error
TypeError: Cannot read property 'createLTR' of undefined
webpack-internal:///./node_modules/react-with-styles/lib/withStyles.js (150:33)
```
Manually registering the interface resolves the issue:
```diff
diff --git a/examples/with-react-with-styles/pages/_app.js b/examples/with-react-with-styles/pages/_app.js
index 91d09a2a9..a393572b8 100644
--- a/examples/with-react-with-styles/pages/_app.js
+++ b/examples/with-react-with-styles/pages/_app.js
@@ -2,11 +2,16 @@ import App from 'next/app'
import React from 'react'
import WithStylesContext from 'react-with-styles/lib/WithStylesContext'
import AphroditeInterface from 'react-with-styles-interface-aphrodite'
+import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet'
import defaultTheme from '../defaultTheme'
class MyApp extends App {
+ constructor(props) {
+ super(props);
+ ThemedStyleSheet.registerInterface(AphroditeInterface)
+ }
render() {
const { Component, pageProps } = this.props
```
But that's not how it is documented. I'm following up with react-with-styles to see if this is a bug.