mirror of https://github.com/buster-so/buster.git
Merge pull request #1046 from buster-so/big-nate-bus-1876-dynamic-components-still-error-out
added vite config for asset bundling
This commit is contained in:
commit
79a121ed97
|
@ -15,7 +15,11 @@ export const AppPageLayoutContent: React.FC<
|
|||
return (
|
||||
<Selector
|
||||
id={id}
|
||||
className={cn('bg-page-background app-content h-full max-h-full overflow-hidden', className)}
|
||||
className={cn(
|
||||
'bg-page-background app-content h-full max-h-full overflow-hidden',
|
||||
'relative', //added this to error boundary components
|
||||
className
|
||||
)}
|
||||
>
|
||||
<ChildSelector>{children}</ChildSelector>
|
||||
</Selector>
|
||||
|
|
|
@ -29,6 +29,7 @@ export const useAppVersion = () => {
|
|||
});
|
||||
|
||||
useEffect(() => {
|
||||
console.log('isChanged', data?.buildId, browserBuild);
|
||||
if (isChanged) {
|
||||
openInfoNotification({
|
||||
duration: Infinity,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { execSync } from 'node:child_process';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
||||
import viteReact from '@vitejs/plugin-react';
|
||||
|
@ -5,6 +6,8 @@ import { defineConfig } from 'vite';
|
|||
import checker from 'vite-plugin-checker';
|
||||
import viteTsConfigPaths from 'vite-tsconfig-paths';
|
||||
|
||||
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||
|
||||
const config = defineConfig(({ command, mode }) => {
|
||||
const isBuild = command === 'build';
|
||||
const isProduction = mode === 'production' || mode === 'staging';
|
||||
|
@ -13,14 +16,20 @@ const config = defineConfig(({ command, mode }) => {
|
|||
const isLocalBuild = process.argv.includes('--local') || mode === 'development';
|
||||
const target = isLocalBuild ? ('bun' as const) : ('vercel' as const);
|
||||
|
||||
// Generate a unique build ID for cache busting after deployments
|
||||
const buildId = `build:${process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8) || process.env.BUILD_ID || Date.now().toString()}`;
|
||||
const buildAt = new Date().toISOString();
|
||||
// Generate a unique version identifier for both build tracking and asset versioning
|
||||
const buildId =
|
||||
process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8) ||
|
||||
process.env.BUILD_ID ||
|
||||
(isProduction ? commitHash : 'dev');
|
||||
const buildAt = new Date().toString();
|
||||
|
||||
// Set the base URL for assets with versioning in production
|
||||
const base = '/';
|
||||
|
||||
return {
|
||||
base,
|
||||
server: { port: 3000 },
|
||||
define: {
|
||||
// Make the build ID available to the app for version tracking
|
||||
'import.meta.env.VITE_BUILD_ID': JSON.stringify(buildId),
|
||||
'import.meta.env.VITE_BUILD_AT': JSON.stringify(buildAt),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue