Files
self/app/vite.config.ts
Justin Hernandez 86656fdca6 Fix lazy loading, web build; revert tree shaking for now (#815)
* Revert "fix yarn web (#814)"

This reverts commit bf158fd977.

* Revert "add hermes ios engine"

This reverts commit f6defcfb12.

* Revert "codex feedback"

This reverts commit df35a47f72.

* Revert "merge with dev"

This reverts commit 47a8d9d2f1.

* Revert "update Gemfile.lock and remove lock when reinstalling"

This reverts commit 5f25752f77.

* Revert "test package update"

This reverts commit 19dcba0e42.

* Revert "revert install cmd changes"

This reverts commit 5427bd12a1.

* Revert "Fix CI build by excluding nokogiri in GitHub Actions/Act environments"

This reverts commit dbff69a13e.

* Revert "prettier"

This reverts commit 87f421456f.

* Revert "fix building"

This reverts commit fbbefd2a3d.

* Revert "optimize path resolving"

This reverts commit 23b1118b8e.

* Revert "fix loading"

This reverts commit f0c884b43b.

* Revert "clean up dupe bundle install"

This reverts commit 5428567bbe.

* Revert "fix metro loading"

This reverts commit 3a766001dc.

* Revert "remove passport provider lazy loading"

This reverts commit 5f793a54b3.

* Revert "allow cursor to edit Gemfile and update lock file"

This reverts commit b6f7158e8e.

* Revert "Update Gemfile.lock to exclude nokogiri in CI environments"

This reverts commit 243640152d.

* Revert "fix install commands"

This reverts commit 2dc7d7c1c9.

* Revert "fix imports and test"

This reverts commit 83d6308029.

* Revert "fix import"

This reverts commit fa42b07ce4.

* Revert "update build checks"

This reverts commit b281f15a16.

* Revert "save updated imports"

This reverts commit 215bca4bee.

* Revert "fix build command"

This reverts commit 37f95bc8fb.

* Revert "build dependencies before linting"

This reverts commit 9e57e017ca.

* Revert "lint suggestions"

This reverts commit ff9b9d2c7c.

* Revert "fix type. more opportunities"

This reverts commit 7ad82d5817.

* Revert "add typing to crypto loader"

This reverts commit d55eec8f44.

* Revert "yarn nice"

This reverts commit df1c2dbd9b.

* Revert "update lock"

This reverts commit 04692ba3b5.

* Revert "cm feedback"

This reverts commit 848071f315.

* fix file name

* fix web loading

* fix border width styling

* fix package commands

* fix import and update lock

* fixes from reverted commits

* more fixes for web building

* fix yarn web:build

* add yarn web:build workflow

* cm feedback

* final fixes

* fix for and vitge

* fix loading
2025-07-30 22:27:49 -07:00

115 lines
3.3 KiB
TypeScript

// SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11
import { tamaguiPlugin } from '@tamagui/vite-plugin';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig({
root: 'web',
publicDir: 'web',
envDir: '..', // This is the directory where Vite will look for .env files relative to the root
resolve: {
extensions: [
'.web.tsx',
'.web.js',
'.web.jsx',
'.web.ts',
'.tsx',
'.ts',
'.jsx',
'.js',
],
alias: {
'@env': path.resolve(__dirname, 'env.ts'),
'/src': path.resolve(__dirname, 'src'),
'react-native-svg': 'react-native-svg-web',
'lottie-react-native': 'lottie-react',
'react-native-safe-area-context': path.resolve(
__dirname,
'src/mocks/react-native-safe-area-context.js',
),
'react-native-gesture-handler': path.resolve(
__dirname,
'src/mocks/react-native-gesture-handler.ts',
),
},
},
plugins: [
react(),
svgr({
include: '**/*.svg',
}),
tamaguiPlugin({
config: path.resolve(__dirname, 'tamagui.config.ts'),
components: ['tamagui'],
enableDynamicEvaluation: true,
excludeReactNativeWebExports: [
'Switch',
'ProgressBar',
'Picker',
'CheckBox',
'Touchable',
],
platform: 'web',
optimize: true,
}),
].filter(Boolean),
define: {
global: 'globalThis',
},
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor-react': [
'react',
'react-dom',
'@react-navigation/native',
'@react-navigation/native-stack',
],
'vendor-ui': ['tamagui', '@tamagui/lucide-icons', '@tamagui/toast'],
'vendor-crypto': [
'elliptic',
'node-forge',
'ethers',
'@peculiar/x509',
'pkijs',
'asn1js',
'@stablelib/cbor',
],
'vendor-device': [
'react-native-nfc-manager',
'react-native-gesture-handler',
'react-native-haptic-feedback',
],
'vendor-analytics': [
'@segment/analytics-react-native',
'@sentry/react',
'@sentry/react-native',
],
'vendor-animations': ['lottie-react-native', 'lottie-react'],
'vendor-cloud': [
'@robinbobin/react-native-google-drive-api-wrapper',
'react-native-cloud-storage',
],
'screens-passport': [
'./src/navigation/passport.ts',
'./src/utils/nfcScanner.ts',
],
'screens-prove': ['./src/navigation/prove.ts', './src/utils/proving'],
'screens-settings': ['./src/navigation/settings.ts'],
'screens-recovery': ['./src/navigation/recovery.ts'],
'screens-dev': ['./src/navigation/dev.ts'],
'screens-aesop': ['./src/navigation/aesop.ts'],
},
},
},
},
});