mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 17:39:40 +02:00
fix(matrix-web): inline vite config for Docker build compatibility
Inline the shared-vite-config settings directly to avoid TypeScript package resolution issues during Docker builds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5e6fd475e
commit
035c75371a
2 changed files with 77 additions and 38 deletions
|
|
@ -28,7 +28,6 @@ COPY packages/shared-theme ./packages/shared-theme
|
|||
COPY packages/shared-types ./packages/shared-types
|
||||
COPY packages/shared-ui ./packages/shared-ui
|
||||
COPY packages/shared-utils ./packages/shared-utils
|
||||
COPY packages/shared-vite-config ./packages/shared-vite-config
|
||||
|
||||
# Copy matrix web app
|
||||
COPY apps/matrix/apps/web ./apps/matrix/apps/web
|
||||
|
|
|
|||
|
|
@ -1,41 +1,81 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import { createViteConfig, mergeViteConfig } from '@manacore/shared-vite-config';
|
||||
import { defineConfig, type UserConfig } from 'vite';
|
||||
|
||||
const baseConfig = createViteConfig({
|
||||
port: 5180,
|
||||
additionalPackages: ['@matrix/shared'],
|
||||
// ManaCore shared packages that need SSR configuration
|
||||
const MANACORE_SHARED_PACKAGES = [
|
||||
'@manacore/shared-icons',
|
||||
'@manacore/shared-ui',
|
||||
'@manacore/shared-tailwind',
|
||||
'@manacore/shared-theme',
|
||||
'@manacore/shared-theme-ui',
|
||||
'@manacore/shared-feedback-ui',
|
||||
'@manacore/shared-feedback-service',
|
||||
'@manacore/shared-feedback-types',
|
||||
'@manacore/shared-auth',
|
||||
'@manacore/shared-auth-ui',
|
||||
'@manacore/shared-branding',
|
||||
'@manacore/shared-subscription-ui',
|
||||
'@manacore/shared-profile-ui',
|
||||
'@manacore/shared-i18n',
|
||||
'@manacore/shared-api-client',
|
||||
'@manacore/shared-splitscreen',
|
||||
'@manacore/shared-utils',
|
||||
'@manacore/shared-tags',
|
||||
'@manacore/shared-stores',
|
||||
'@manacore/shared-help-types',
|
||||
'@manacore/shared-help-content',
|
||||
'@manacore/shared-help-ui',
|
||||
];
|
||||
|
||||
const noExternal = [...MANACORE_SHARED_PACKAGES, '@matrix/shared'];
|
||||
const exclude = [...MANACORE_SHARED_PACKAGES];
|
||||
|
||||
const baseConfig: Partial<UserConfig> = {
|
||||
server: {
|
||||
port: 5180,
|
||||
strictPort: true,
|
||||
},
|
||||
ssr: {
|
||||
noExternal,
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude,
|
||||
},
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
plugins: [tailwindcss(), sveltekit()],
|
||||
server: {
|
||||
...baseConfig.server,
|
||||
headers: {
|
||||
// Required for WASM module loading
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp',
|
||||
},
|
||||
},
|
||||
ssr: {
|
||||
...baseConfig.ssr,
|
||||
},
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
optimizeDeps: {
|
||||
...baseConfig.optimizeDeps,
|
||||
include: ['buffer', 'events'],
|
||||
// WASM modules cannot be pre-bundled
|
||||
exclude: [...exclude, '@matrix-org/matrix-sdk-crypto-wasm'],
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
format: 'es',
|
||||
},
|
||||
build: {
|
||||
target: 'esnext',
|
||||
},
|
||||
});
|
||||
|
||||
export default defineConfig(
|
||||
mergeViteConfig(baseConfig, {
|
||||
plugins: [tailwindcss(), sveltekit()],
|
||||
server: {
|
||||
headers: {
|
||||
// Required for WASM module loading
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp',
|
||||
},
|
||||
},
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['buffer', 'events'],
|
||||
// WASM modules cannot be pre-bundled
|
||||
exclude: ['@matrix-org/matrix-sdk-crypto-wasm'],
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
format: 'es',
|
||||
},
|
||||
build: {
|
||||
target: 'esnext',
|
||||
},
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue