-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE3] pwa setting #21
Conversation
JaeMeDev
commented
Aug 10, 2022
- next-pwa를 통한 pwa 설정
|
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 63 63
Branches 3 3
=========================================
Hits 63 63 📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
next.config.js
Outdated
module.exports = isProd ? withPlugins( | ||
[ | ||
[ | ||
withPWA, | ||
{ | ||
pwa: { | ||
dest: 'public', | ||
runtimeCaching, | ||
}, | ||
}, | ||
], | ||
], | ||
nextConfig, | ||
) : nextConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withPWA에 disable 옵션이 있어용
다음과 같이 적용하면 dev환경에서는 PWA가 적용되지 않아요
module.exports = withPlugins([
[withPWA, {
pwa: {
dest: 'public',
maximumFileSizeToCacheInBytes: 7000000,
disable: process.env.NODE_ENV === 'development',
runtimeCaching,
},
}],
], nextConfig);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다. 원래 disable
옵션 줘서 작업했는데 develop환경에서 pwa가 오작동 하는 것 같아 빼고 저렇게 작업했었습니다. (결국엔 전부 오작동 하고 있었지만...)
알아보니 next-pwa@5.5.5
에서 pwa 옵션이 빠져서 오작동하는 문제였고 next-pwa@5.5.4
로 버전 변경해서 문제해결했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 맞아요 이 이슈 있었어요👍
package.json
Outdated
@@ -93,6 +94,7 @@ | |||
"jest-environment-jsdom": "^28.1.1", | |||
"jest-plugin-context": "^2.9.0", | |||
"lint-staged": "^13.0.3", | |||
"next-compose-plugins": "^2.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next-compose-plugins는 런타임에도 필요한 플러그인이기 때문에 devDependencies가 아니라 dependencies로 설치해야합니다. 대부분의 플러그인 사용은 런타임에 필요해용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다!
src/pages/_document.page.tsx
Outdated
Head, Html, Main, NextScript, | ||
} from 'next/document'; | ||
|
||
export default class MyDocument extends Document { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default는 이렇게 하는게 좋아보여요!
export default MyDocument;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다!
42f8943
to
f924561
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니당~~
1001103
to
178d88f
Compare