mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 05:41:43 +03:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { loadEnv, defineConfig } from 'vite';
|
|
import analyze from 'rollup-plugin-analyzer';
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
import reactRefresh from '@vitejs/plugin-react-refresh';
|
|
import { urbitPlugin } from '@urbit/vite-plugin-urbit';
|
|
import { execSync } from 'child_process';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default ({ mode }) => {
|
|
process.env.VITE_STORAGE_VERSION = Date.now().toString();
|
|
|
|
Object.assign(process.env, loadEnv(mode, process.cwd()));
|
|
const SHIP_URL = process.env.SHIP_URL || process.env.VITE_SHIP_URL || 'http://localhost:8080';
|
|
console.log(SHIP_URL);
|
|
|
|
return defineConfig({
|
|
base: mode === 'mock' ? undefined : '/apps/grid/',
|
|
server: mode === 'mock' ? undefined : { https: true },
|
|
build:
|
|
mode !== 'profile'
|
|
? undefined
|
|
: {
|
|
rollupOptions: {
|
|
plugins: [
|
|
analyze({
|
|
limit: 20
|
|
}),
|
|
visualizer()
|
|
]
|
|
}
|
|
},
|
|
plugins:
|
|
mode === 'mock'
|
|
? []
|
|
: [urbitPlugin({ base: 'grid', target: SHIP_URL, secure: false }), reactRefresh()]
|
|
});
|
|
};
|