mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-14 07:44:04 +00:00
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
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { fileURLToPath } from 'node:url';
|
|
import ts from '@babel/preset-typescript';
|
|
import react from '@vitejs/plugin-react-swc';
|
|
import million from 'million/compiler';
|
|
import { defineConfig } from 'vite';
|
|
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
import i18nextLoader from 'vite-plugin-i18next-loader';
|
|
import svg from 'vite-plugin-svgr';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
import { narrowSolidPlugin } from './narrowSolidPlugin';
|
|
|
|
const url = new URL('../../../interface/locales', import.meta.url);
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
million.vite({ auto: true }),
|
|
tsconfigPaths(),
|
|
i18nextLoader({
|
|
paths: [fileURLToPath(url.href)],
|
|
namespaceResolution: 'relativePath'
|
|
}),
|
|
react(),
|
|
narrowSolidPlugin({ include: '**/*.solid.tsx', babel: { presets: [[ts, {}]] } }),
|
|
svg({ svgrOptions: { icon: true } }),
|
|
createHtmlPlugin({
|
|
minify: true
|
|
})
|
|
],
|
|
css: {
|
|
modules: {
|
|
localsConvention: 'camelCaseOnly'
|
|
}
|
|
},
|
|
root: 'src',
|
|
build: {
|
|
sourcemap: process.env.GENERATE_SOURCEMAP === 'false' ? false : true,
|
|
outDir: '../dist',
|
|
assetsDir: '.'
|
|
}
|
|
});
|