diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6426568..f259023a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: with: node-version: 22 - name: Build React app (with Node v22) - run: CI='' yarn build + run: CI='' NODE_ENV=production yarn build - name: Build Electron app for Linux (with Node v22) run: yarn electron:build:linux - name: List dist directory @@ -82,7 +82,7 @@ jobs: with: node-version: 22 - name: Build React app (with Node v22) - run: CI='' yarn build + run: CI='' NODE_ENV=production yarn build - name: Build Electron app for Mac (with Node v22) run: yarn electron:build:mac - name: List dist directory @@ -116,7 +116,7 @@ jobs: - name: Install dependencies (with Node v22) # --network-timeout and --network-concurrency are yarn v1 flags. run: yarn install --frozen-lockfile --network-timeout 100000 --network-concurrency 1 - name: Build React app (with Node v22) - run: yarn build + run: NODE_ENV=production yarn build - name: Build Electron app for Windows (with Node v22) run: yarn electron:build:windows - name: List dist directory @@ -158,7 +158,7 @@ jobs: - name: Install dependencies (with Node v20) run: yarn install --frozen-lockfile --ignore-engines # build react app - - run: CI='' yarn build + - run: CI='' NODE_ENV=production yarn build # set android versionCode and versionName - run: sed -i "s/versionCode 1/versionCode $(git tag | wc -l)/" ./android/app/build.gradle - run: sed -i "s/versionName \"1.0\"/versionName \"$(node -e "console.log(require('./package.json').version)")\"/" ./android/app/build.gradle diff --git a/package.json b/package.json index 9144ffdc..f69a021d 100755 --- a/package.json +++ b/package.json @@ -59,12 +59,12 @@ }, "scripts": { "start": "vite", - "build": "cross-env PUBLIC_URL=./ GENERATE_SOURCEMAP=false vite build", - "build:preload": "vite build --config electron/vite.preload.config.js", - "build-netlify": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" PUBLIC_URL=./ GENERATE_SOURCEMAP=true VITE_COMMIT_REF=$COMMIT_REF CI='' vite build", + "build": "cross-env NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=false vite build", + "build:preload": "cross-env NODE_ENV=production vite build --config electron/vite.preload.config.js", + "build-netlify": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=true VITE_COMMIT_REF=$COMMIT_REF CI='' vite build", "test": "vitest", "preview": "vite preview", - "analyze-bundle": "cross-env PUBLIC_URL=./ GENERATE_SOURCEMAP=true vite build && npx source-map-explorer 'build/assets/*.js'", + "analyze-bundle": "cross-env NODE_ENV=production PUBLIC_URL=./ GENERATE_SOURCEMAP=true vite build && npx source-map-explorer 'build/assets/*.js'", "electron": "yarn build:preload && cross-env ELECTRON_IS_DEV=1 yarn electron:before && cross-env ELECTRON_IS_DEV=1 electron .", "electron:no-delete-data": "yarn electron:before:download-ipfs && electron .", "electron:start": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && yarn electron\"", diff --git a/vite.config.js b/vite.config.js index 800a24f0..34a31314 100644 --- a/vite.config.js +++ b/vite.config.js @@ -7,6 +7,7 @@ import { VitePWA } from 'vite-plugin-pwa'; import reactScan from '@react-scan/vite-plugin-react-scan'; const isProduction = process.env.NODE_ENV === 'production'; +const isDevelopment = process.env.NODE_ENV === 'development'; export default defineConfig({ plugins: [ @@ -19,7 +20,8 @@ export default defineConfig({ ] } }), - !isProduction && reactScan({ + // Only include React Scan in development mode - never in production builds + (isDevelopment || (!isProduction && process.env.NODE_ENV !== 'production')) && reactScan({ showToolbar: true, playSound: true, }),