mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-06-28 06:46:24 +00:00
- Create new @lifeforge/localization package with client-i18n-config, I18nInitProvider, and useModuleTranslation hook - Rename ModuleHeaderStateProvider -> ModuleMetadataProvider and move to @lifeforge/federation - Move I18nInitProvider from apps/web to @lifeforge/localization with configurable init/fallbacks - Add module name to ModuleMetadataProvider context for scoped translations - Wire up @lifeforge/localization and @lifeforge/federation as dependencies in @lifeforge/ui - Update ModuleHeader to use useModuleTranslation for scoped i18n namespaces - Register @lifeforge/localization in shared-packages config - Update docs vite config with federation plugin
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import mdx, { Options } from '@mdx-js/rollup'
|
|
import react from '@vitejs/plugin-react'
|
|
import federation from '@originjs/vite-plugin-federation'
|
|
import path from 'node:path'
|
|
import remarkGfm from 'remark-gfm'
|
|
import { defineConfig } from 'vite'
|
|
|
|
import mdxListCountsPlugin from './plugins/mdxListCountsPlugin'
|
|
|
|
const options: Options = {
|
|
remarkPlugins: [remarkGfm]
|
|
}
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
mdx(options),
|
|
mdxListCountsPlugin(),
|
|
federation({
|
|
name: 'docs-host',
|
|
remotes: {
|
|
None: ''
|
|
},
|
|
shared: ['react', 'react-dom']
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
}
|
|
},
|
|
build: {
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true
|
|
},
|
|
target: 'esnext',
|
|
sourcemap: false,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes('node_modules')) {
|
|
return id
|
|
.toString()
|
|
.split('node_modules/')
|
|
.pop()!
|
|
.split('/')[0]
|
|
.toString()
|
|
} else if (id.endsWith('.mdx')) {
|
|
const mdxPath = id.toString().split('src/')[1]
|
|
|
|
return `mdx-${mdxPath.replace(/\//g, '-').replace('.mdx', '')}`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
sourcemap: false,
|
|
target: 'esnext'
|
|
}
|
|
}
|
|
})
|