Improve prod bundle size (#2447)
Greatly improve production build size, now prod builds are 1/3 of the size - Main spacedrive binary went from ~120M to ~40M - Add more optimize options for rust prod build - Improve vite settings for front-end prod build - Improve lossless compression of PNGs - Don't include videos in bundles when they are not used - Don't generate/bundle sourcemap for prod builds
|
@ -117,3 +117,11 @@ opt-level = 3
|
|||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
incremental = false
|
||||
|
||||
# Optimize release builds
|
||||
[profile.release]
|
||||
panic = "abort" # Strip expensive panic clean-up logic
|
||||
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
|
||||
lto = true # Enables link to optimizations
|
||||
opt-level = "s" # Optimize for binary size
|
||||
strip = true # Remove debug symbols
|
||||
|
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 70 KiB |
|
@ -63,3 +63,11 @@ default = ["custom-protocol"]
|
|||
devtools = ["tauri/devtools"]
|
||||
ai-models = ["sd-core/ai"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
# Optimize release builds
|
||||
[profile.release]
|
||||
panic = "abort" # Strip expensive panic clean-up logic
|
||||
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
|
||||
lto = true # Enables link to optimizations
|
||||
opt-level = "s" # Optimize for binary size
|
||||
strip = true # Remove debug symbols
|
||||
|
|
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 70 KiB |
|
@ -25,6 +25,15 @@ export default defineConfig(({ mode }) => {
|
|||
server: {
|
||||
port: 8001
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
treeshake: 'recommended',
|
||||
external: [
|
||||
// Don't bundle Fda video for non-macOS platforms
|
||||
process.platform !== 'darwin' && /^@sd\/assets\/videos\/Fda.mp4$/
|
||||
].filter(Boolean)
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
devtoolsPlugin,
|
||||
process.env.SENTRY_AUTH_TOKEN &&
|
||||
|
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 741 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 524 KiB After Width: | Height: | Size: 360 KiB |
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 278 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 278 KiB |
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 4.6 MiB After Width: | Height: | Size: 3.4 MiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 978 KiB |
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 319 KiB |
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 319 KiB |
Before Width: | Height: | Size: 447 KiB After Width: | Height: | Size: 382 KiB |
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 313 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 62 KiB |
|
@ -1,6 +1,6 @@
|
|||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { AppLogo, BloomOne } from '@sd/assets/images';
|
||||
import { SdMobIntro } from '@sd/assets/videos';
|
||||
import SdMobIntro from '@sd/assets/videos/SdMobIntro.mp4';
|
||||
import { ResizeMode, Video } from 'expo-av';
|
||||
import { Image } from 'expo-image';
|
||||
import { MotiView } from 'moti';
|
||||
|
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.9 KiB |
|
@ -1,4 +1,4 @@
|
|||
import { Fda } from '@sd/assets/videos';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { Button } from '@sd/ui';
|
||||
import { Icon } from '~/components';
|
||||
|
@ -8,18 +8,40 @@ import { usePlatform } from '~/util/Platform';
|
|||
import { OnboardingContainer, OnboardingDescription, OnboardingTitle } from './components';
|
||||
|
||||
export const FullDisk = () => {
|
||||
const [fdaVideo, setFdaVideo] = useState<string | null>(null);
|
||||
const { requestFdaMacos } = usePlatform();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { t } = useLocale();
|
||||
|
||||
useEffect(() => {
|
||||
import('@sd/assets/videos/Fda.mp4').then(
|
||||
(module) => {
|
||||
setFdaVideo(module.default);
|
||||
},
|
||||
(err) => {
|
||||
console.error(err);
|
||||
navigate('../locations', { replace: true });
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<OnboardingContainer>
|
||||
<Icon name="HDD" size={80} />
|
||||
<OnboardingTitle>{t('full_disk_access')}</OnboardingTitle>
|
||||
<OnboardingDescription>{t('full_disk_access_description')}</OnboardingDescription>
|
||||
<div className="mt-5 w-full max-w-[450px]">
|
||||
<video className="rounded-md" autoPlay loop muted controls={false} src={Fda} />
|
||||
{fdaVideo && (
|
||||
<video
|
||||
className="rounded-md"
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
controls={false}
|
||||
src={fdaVideo}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Button onClick={requestFdaMacos} variant="gray" size="sm" className="my-5">
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 734 B |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 1,017 B After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 43 KiB |