diff --git a/examples/with-next-sass/pages/_document.js b/examples/with-next-sass/pages/_document.js deleted file mode 100644 index 58fa5204afbc3..0000000000000 --- a/examples/with-next-sass/pages/_document.js +++ /dev/null @@ -1,15 +0,0 @@ -import Document, { Head, Main, NextScript } from 'next/document' - -export default class MyDocument extends Document { - render () { - return ( - <html> - <Head /> - <body> - <Main /> - <NextScript /> - </body> - </html> - ) - } -} diff --git a/examples/with-static-export/README.md b/examples/with-static-export/README.md index cc8b53d6f7658..46023bdd1415f 100644 --- a/examples/with-static-export/README.md +++ b/examples/with-static-export/README.md @@ -36,6 +36,6 @@ yarn dev ## The idea behind the example -This example show how to export to static HTML files your Next.js application fetching data from an API to generate a dynamic list of pages. This use a custom Express server in development to configure custom routing and then generate a map of pages to export for production. +This example show how to export to static HTML files your Next.js application fetching data from an API to generate a dynamic list of pages. When trying to run `npm start` it will build and export your pages into the `out` folder and serve them on `localhost:5000`. diff --git a/examples/with-static-export/components/post.js b/examples/with-static-export/components/post.js index 149b0e8d32851..f6938a5f0a921 100644 --- a/examples/with-static-export/components/post.js +++ b/examples/with-static-export/components/post.js @@ -1,14 +1,10 @@ import Link from 'next/link' -export default props => ( +export default ({ title, body, id }) => ( <article> - <h2>{props.title}</h2> - <p>{props.body}</p> - {/* render the URL as /post/:id */} - <Link - href={{ pathname: '/post', query: { id: props.id } }} - as={`/post/${props.id}`} - > + <h2>{title}</h2> + <p>{body}</p> + <Link href='/post/[id]' as={`/post/${id}`}> <a>Read more...</a> </Link> </article> diff --git a/examples/with-static-export/next.config.js b/examples/with-static-export/next.config.js index cfd1cd46aa65f..615ba341ebd35 100644 --- a/examples/with-static-export/next.config.js +++ b/examples/with-static-export/next.config.js @@ -13,7 +13,7 @@ module.exports = { (pages, post) => Object.assign({}, pages, { [`/post/${post.id}`]: { - page: '/post', + page: '/post/[id]', query: { id: post.id } } }), diff --git a/examples/with-static-export/package.json b/examples/with-static-export/package.json index 537cc1e971b8b..ec205550536b1 100644 --- a/examples/with-static-export/package.json +++ b/examples/with-static-export/package.json @@ -1,16 +1,14 @@ { "name": "with-static-export", - "main": "server.js", "dependencies": { - "express": "^4.15.3", - "isomorphic-unfetch": "^2.0.0", + "isomorphic-unfetch": "^3.0.0", "next": "latest", - "react": "^16.7.0", - "react-dom": "^16.7.0", - "serve": "9.4.0" + "react": "^16.11.0", + "react-dom": "^16.11.0", + "serve": "11.2.0" }, "scripts": { - "dev": "node .", + "dev": "next", "build": "next build", "preexport": "npm run build", "export": "next export", diff --git a/examples/with-static-export/pages/post.js b/examples/with-static-export/pages/post/[id].js similarity index 83% rename from examples/with-static-export/pages/post.js rename to examples/with-static-export/pages/post/[id].js index e8bd2832c2439..b942799206474 100644 --- a/examples/with-static-export/pages/post.js +++ b/examples/with-static-export/pages/post/[id].js @@ -14,15 +14,17 @@ export default class extends Component { } render () { + const { title, body } = this.props + return ( <main> <Head> - <title>{this.props.title}</title> + <title>{title}</title> </Head> - <h1>{this.props.title}</h1> + <h1>{title}</h1> - <p>{this.props.body}</p> + <p>{body}</p> <Link href='/'> <a>Go back to home</a> diff --git a/examples/with-static-export/server.js b/examples/with-static-export/server.js deleted file mode 100644 index 5957084101327..0000000000000 --- a/examples/with-static-export/server.js +++ /dev/null @@ -1,27 +0,0 @@ -const express = require('express') -const next = require('next') - -const port = parseInt(process.env.PORT, 10) || 3000 -const dev = process.env.NODE_ENV !== 'production' -const app = next({ dev }) -const handle = app.getRequestHandler() - -app.prepare().then(() => { - const server = express() - - // custom route for posts - server.get('/post/:id', (req, res) => { - return app.render(req, res, '/post', { - id: req.params.id - }) - }) - - server.get('*', (req, res) => { - return handle(req, res) - }) - - server.listen(port, err => { - if (err) throw err - console.log(`> Ready on http://localhost:${port}`) - }) -}) diff --git a/lerna.json b/lerna.json index dd549e8767de6..fd2e82adb9f33 100644 --- a/lerna.json +++ b/lerna.json @@ -17,5 +17,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "9.1.2-canary.9" + "version": "9.1.2-canary.10" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 27bc7b3d4be2d..895cf19532d6d 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "9.1.2-canary.9", + "version": "9.1.2-canary.10", "keywords": [ "react", "next", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index e3e40d30b3e31..0356eb534dcc0 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "9.1.2-canary.9", + "version": "9.1.2-canary.10", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index b5c963df56489..68a71e26fa7a3 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "9.1.2-canary.9", + "version": "9.1.2-canary.10", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next/README.md b/packages/next/README.md index c20c3fd7817c1..9bdf0694099e7 100644 --- a/packages/next/README.md +++ b/packages/next/README.md @@ -2317,16 +2317,35 @@ To learn more about TypeScript checkout its [documentation](https://www.typescri > When you feel comfortable with TypeScript, you may turn this option on in your `tsconfig.json`. > **Note**: By default, Next.js reports TypeScript errors during development for pages you are actively working on. -> TypeScript errors for inactive pages do not block the development process. -> Trying to run `next build` for an app that has TypeScript errors on any page will fail. -> -> If you don't want to leverage this behavior and prefer to do type checks manually, set the following options in your `next.config.js`: +> TypeScript errors for inactive pages **do not** block the development process. +> +> If you don't want to leverage this behavior and instead, e.g. prefer your editor's integration, you can set the following option in `next.config.js`: > > ```js > // next.config.js > module.exports = { > typescript: { > ignoreDevErrors: true, +> }, +> } +> ``` +> +> Next.js will still fail your **production build** (`next build`) when TypeScript errors are present in your project. +> +> If you'd like Next.js to dangerously produce production code even when your application is broken, you can set the following option in your `next.config.js`. +> Be sure you are running type checks as part of your build or deploy process! +> +> ```js +> // next.config.js +> module.exports = { +> typescript: { +> // !! WARN !! +> // Dangerously allow production builds to successfully complete even if +> // your project has type errors. +> // +> // This option is rarely needed, and should be reserved for advanced +> // setups. You may be looking for `ignoreDevErrors` instead. +> // !! WARN !! > ignoreBuildErrors: true, > }, > } diff --git a/packages/next/package.json b/packages/next/package.json index 9850f346fb04b..e0b0e39d030e5 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "9.1.2-canary.9", + "version": "9.1.2-canary.10", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT",