Comments (7)
I think this is really awesome that you were able to resolve the problem so quickly, but I'm sorry this is kinda too little too late. The "latest" is whatever is on the site. I went to the site and clicked on the "latest" button that said tutorial. I ran through the latest instructions and I got this defect. So as far as I am concerned, i wasn't not running an older version. I followed the latest instructions.
Hopefully this can be corrected for the next person who is looking at NextJs as a static-site generation tool. It's a good tool, so I hope it works out for them.
I'll be using something else, but will come back to NextJs when i want something more sophisticated, such as a starter-app for React
from staticgen.
As you can see the default behaviour works as expected with the latest version of Next.js:
yarn create next-app --example basic-export basic-export-app
yarn create v1.7.0
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Installed "[email protected]" with binaries:
- create-next-app
> Success! Downloaded basic-export files for basic-export-app
Installing npm modules:
react
react-dom
next
> Success! Installed dependencies for basic-export-app
Awesome! You're now ready to start coding.
We already ran yarn for you, so your next steps are:
$ cd basic-export-app
To build a version for production:
$ yarn build
To run the server in production:
$ yarn start
To start a local server for development:
$ yarn dev
Questions? Feedback? Please let us know!
https://github.com/segmentio/create-next-app/issues
✨ Done in 40.95s.
▲ sandbox cd basic-export-app
▲ basic-export-app yarn build
yarn run v1.7.0
$ next build
✨ Done in 4.70s.
▲ basic-export-app yarn export
yarn run v1.7.0
$ next export
> using build directory: /Users/timneutkens/projects/sandbox/basic-export-app/.next
copying "static build" directory
> No "exportPathMap" found in "next.config.js". Generating map from "./pages"
> exporting path: /about
> exporting path: /about2
> exporting path: /day
> exporting path: /index
> exporting path: /_error
> exporting path: /
✨ Done in 0.61s.
from staticgen.
Could not find "exportPathMap" function inside "next.config.js"
Looking through the documentation, it looks like you need to do more coding to get all that to work. It seems like static-site generation is an afterthought for nextjs and very poortly implemented, if anyone even gets it to work.
As per vercel/next.js#1972 this hasn't been a requirement anymore since Next.js 6+.
I suspect that's not the main Use Case anyway. Going through the tutorial and the overview, it hardly mentions that Use Case. It's deeper in the docs, and I honestly would have missed it entirely if it hadn't been for the fact that the StaticGen site pointed me to it.
Next.js implements the process of pre-rendering. In case of next export
you pre-render to static HTML. If using next start
pages are rendered on-demand. It's definitely one of the main use cases of Next.js.
from staticgen.
Here's how to reproduce it:
git clone https://github.com/arunoda/learnnextjs-demo.git
cd learnnextjs-demo
git checkout getting-started
npm install
npm run dev
(shutdown the server)
node_modules\.bin\next build
node_modules\.bin\next export
My package.json:
{
"name": "hello-next",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "next"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"next": "^4.2.0",
"react": "^16.2.0",
"react-dom": "^16.2.0"
}
}
from staticgen.
"next": "^4.2.0",
As per what I said earlier:
As per vercel/next.js#1972 this hasn't been a requirement anymore since Next.js 6+.
So the example should just be upgraded to the latest version.
from staticgen.
@kasajian I use nextjs to build static websites and it works quite well. A couple of examples:
Clone either of those, then
npm install
npm run build
npm run export
cd out # and here it is
from staticgen.
I'm creating a PR to fix the Next.js version 👌
from staticgen.
Related Issues (20)
- bug: sorting by language and/or by template is broke HOT 1
- Bug: List tile links to wrong framework HOT 4
- Pull request #662 failed HOT 1
- bug: Fails to fetch mdBook GitHub meta data
- Add tracking to the "Deploy to Netlify" buttons and the "Share to..." buttons HOT 1
- Dart HOT 1
- Fetch Twitter List Members HOT 1
- TypeScript shows up twice in the language filter
- Sorting is broken HOT 2
- Adding more powerful filters
- Allow linking to filtered results
- [Question] reason move from react-static to gasby? HOT 1
- adding Franklin.jl HOT 1
- List/sort/filter on number of themes available per generator
- enable IPv6 on www.staticgen.com
- Allow website to build without sensitives variables
- Remove / update Statie -> Symfony Static Dumper
- Add Nimatic HOT 2
- Gitbook is now commercial
- The new site ignores double curly brackets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staticgen.