Skip to content

Commit f91d912

Browse files
committed
Ignore getStaticProps and getStaticPaths for mobile webview build
1 parent 625eede commit f91d912

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ email-preview
9090
/backups/firebase/storage/data/
9191

9292
android/app/release*
93-
icons/
93+
icons/
94+
*.bak

scripts/build_web.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,19 @@ cd web
2727

2828
rm -rf .next
2929

30+
# Hack to ignore getStaticProps and getStaticPaths for mobile webview build
31+
# as Next.js doesn't support SSR / ISR on mobile
32+
USERNAME_PAGE=pages/[username]/index.tsx
33+
34+
# rename getStaticProps to _getStaticProps
35+
sed -i.bak 's/\bgetStaticProps\b/_getStaticProps/g' $USERNAME_PAGE
36+
37+
# rename getStaticPaths to _getStaticPaths
38+
sed -i.bak 's/\bgetStaticPaths\b/_getStaticPaths/g' $USERNAME_PAGE
39+
3040
yarn build
41+
42+
sed -i.bak 's/\b_getStaticProps\b/getStaticProps/g' $USERNAME_PAGE
43+
44+
# rename getStaticPaths to _getStaticPaths
45+
sed -i.bak 's/\b_getStaticPaths\b/getStaticPaths/g' $USERNAME_PAGE

0 commit comments

Comments
 (0)