18dc1f66c6
Since 9.4 release, fetch is pollyfilled by default from #12353, so the import is not needed anymore. |
||
---|---|---|
.. | ||
components | ||
pages | ||
package.json | ||
README.md |
Static export 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.
When trying to run npm start
it will build and export your pages into the out
folder and serve them on localhost:5000
.
How to use
Using create-next-app
Execute create-next-app
with npm or Yarn to bootstrap the example:
npm init next-app --example with-static-export with-static-export-app
# or
yarn create next-app --example with-static-export with-static-export-app
Download manually
Download the example:
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-static-export
cd with-static-export
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev