Merge pull request #274 from timlrx/fix/dev-socket

fix: do not load socketio for next dev
This commit is contained in:
Timothy 2021-11-19 00:13:18 +08:00 committed by GitHub
commit 16e1b682ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,7 @@
"version": "1.2.1",
"private": true,
"scripts": {
"start": "node ./scripts/next-remote-watch.js ./data",
"start": "cross-env SOCKET=true node ./scripts/next-remote-watch.js ./data",
"dev": "next dev",
"build": "next build && node ./scripts/generate-sitemap",
"serve": "next start",

View File

@ -9,6 +9,7 @@ import LayoutWrapper from '@/components/LayoutWrapper'
import { ClientReload } from '@/components/ClientReload'
const isDevelopment = process.env.NODE_ENV === 'development'
const isSocket = process.env.SOCKET
export default function App({ Component, pageProps }) {
return (
@ -16,7 +17,7 @@ export default function App({ Component, pageProps }) {
<Head>
<meta content="width=device-width, initial-scale=1" name="viewport" />
</Head>
{isDevelopment && <ClientReload />}
{isDevelopment && isSocket && <ClientReload />}
<Analytics />
<LayoutWrapper>
<Component {...pageProps} />