getStaticProps overrides exportPathMap
See original GitHub issueBug report
Describe the bug
Adding getStaticProps
overrides folder settings set within exportPathMap
in next.config.js
.
I’m essentially trying to get my html files to be output in /directory/index.html
rather than /directory.html
. Unfortunately even I set my exportPathMap
to do so, as soon as the getStaticProps
function is added in my script, the setting is overridden and the file will be output at directory.html
To Reproduce
git clone https://github.com/creativiii/next-js-export-bug
cd next-js-export-but
npm run build
npm run export
Then check the out
directory.
Expected behavior
page-1
and page-2
should be respectively exported in /page-1/index.html
and /page-2/index.html
. Instead page-2
is exported as page-2.html
.
System information
- OS: [e.g. macOS, Windows]: WSL Ubuntu 20.04
- Version of Next.js: [e.g. 6.0.2] 9.4.4
- Version of Node.js: [e.g. 10.10.0] LTS 12
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:20 (7 by maintainers)
Top Results From Across the Web
exportPathMap - next.config.js
Warning: Using exportPathMap for defining routes with any getStaticPaths powered page is now ignored and gets overridden. We recommend not to use them...
Read more >NextJS: How do I get exportPathMap page data? I don't see it ...
I have set up exportPathMap but I get an empty object when exporting getStaticProps from my component. I don't understand how I'm supposed ......
Read more >Static HTML Export with i18n compatibility in Next.js
components/Link' + const getStaticProps ... info - Copying "static build" directory info - No "exportPathMap" found in ...
Read more >Creating a Markdown Blog with Next.js - Tina.io
You can use getStaticProps to fetch data from an external api, ... don't have to worry about accidentally overriding a style somewhere else....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have you tried enabling this option?
getStaticProps
is completely useless withnext export
. (AlsoexportPathMap
)I think the Next.js dev team is thinking the people around the world using the Next.js just to create a single “index.js” file, and print a “hello world!”
All the communication between the dev team and us is just like that: “We will not create a solution, use the Next.js just like that or else…”
Anyway, Thanks.