title | date |
---|---|
dev - 2020/12 |
2020-12-02 01:36:30 UTC |
- SSR needs server environment -> X
- SSG exports HTML -> X
애당초 next.js의 routing은 page기반이라
기존에 cordova에서 index.html만 미리 넣어놓고 나머지 페이지를 resource로 땡겨올 수 있는 SPA가 아니다.
굳이 하려면 일단 라우터 쪽 부터 뜯어고쳐야 함.
https://colinhacks.com/essays/building-a-spa-with-nextjs
근데 SSR, SSG 안 될거 같고 라우터도 손보는 수고가 필요하면 next.js 쓰는 메리트가…
react-native-web으로 공통 components 쓰되 2개의 project 운영해야 하나 싶었는데...
web / app 분리 예정이라 필요 없어짐.
The problem is, that link is not real - it cannot be bookmarked or navigated to directly via the url bar.
Alternate answer if you want your URLs to be "clean" and not have .html on the end.
To get Next.js default URL links working properly with S3/Cloudfront, you must configure the "add a trailing slash" option in your next.config.js:
module.exports = {
trailingSlash: true,
}
As per the documentation
export pages as index.html files and require trailing slashes, /about becomes /about/index.html and is routable via /about/.