chore(fontend-public): 🔧 Update TypeScript configs (tsconfig.json) and Vite plugins (vite.config.ts) for cross-module consistency and feature flag support
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
476262a54a
commit
3adc47efe3
6 changed files with 41 additions and 2 deletions
|
|
@ -31,7 +31,8 @@
|
|||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
"src/**/*",
|
||||
"msw/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"],
|
||||
"@features/config": ["../../../@packages/@config/src/index.ts"],
|
||||
"@features/*": ["../../*"],
|
||||
"@packages/*": ["../../../@packages/*"],
|
||||
"@i18n-locales/*": ["../../i18n/locales/*"],
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ export default defineConfig({
|
|||
// Deployment locale manifest (fallback to atlilith.www when feature runs standalone)
|
||||
'@deployment-locale-manifest': path.resolve(__dirname, '../../../../deployments/@domains/atlilith.www/root/src/locale-manifest.ts'),
|
||||
// Feature shared modules (specific paths BEFORE generic @features prefix)
|
||||
'@features/config': path.resolve(__dirname, '../../../@packages/@config/src'),
|
||||
'@features/i18n': path.resolve(__dirname, '../../i18n'),
|
||||
'@features/feature-flags/react': path.resolve(__dirname, '../../feature-flags/shared/dist/react.js'),
|
||||
'@features/marketplace': path.resolve(__dirname, '../../marketplace/shared/src'),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@features/config": ["../../../@packages/@config/src/index.ts"],
|
||||
"@features/payments/*": ["../../payments/*"],
|
||||
"@components/*": ["./src/components/*"],
|
||||
"@hooks/*": ["./src/hooks/*"],
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ export default defineConfig({
|
|||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
'@features/config': path.resolve(__dirname, '../../../@packages/@config/src'),
|
||||
'@features/payments': path.resolve(__dirname, '../../payments'),
|
||||
'@components': path.resolve(__dirname, './src/components'),
|
||||
'@hooks': path.resolve(__dirname, './src/hooks'),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export default defineConfig(({ mode }) => {
|
|||
const vitePort = parseInt(env.VITE_PORT || '5200', 10);
|
||||
const attrBackendPort = parseInt(env.ATTR_BACKEND_PORT || '3015', 10);
|
||||
const profileBackendPort = parseInt(env.PROFILE_BACKEND_PORT || '5434', 10);
|
||||
const assistantBackendPort = parseInt(env.ASSISTANT_BACKEND_PORT || '3033', 10);
|
||||
const uiPackagesRoot =
|
||||
env.UI_PACKAGES_ROOT ||
|
||||
path.resolve(__dirname, '../../../../../../../@packages/@ts/@ui-react/packages');
|
||||
|
|
@ -22,8 +23,10 @@ export default defineConfig(({ mode }) => {
|
|||
// Per-route proxy: attribute routes → profile backend (for category enhancement), profile routes → profile backend
|
||||
const attrBackend = `http://localhost:${attrBackendPort}`;
|
||||
const profileBackend = `http://localhost:${profileBackendPort}`;
|
||||
const assistantBackend = `http://localhost:${assistantBackendPort}`;
|
||||
const proxy = {
|
||||
// Attribute definitions go through profile backend for UI category enhancement
|
||||
'/api/assistant': assistantBackend,
|
||||
'/api/attribute-definitions': {
|
||||
target: profileBackend,
|
||||
rewrite: (path: string) => path.replace('/api/attribute-definitions', '/api/profile/attributes/definitions'),
|
||||
|
|
@ -56,8 +59,13 @@ export default defineConfig(({ mode }) => {
|
|||
});
|
||||
}
|
||||
|
||||
// codebase/features/ root — allows Vite to serve any feature's shared source dirs.
|
||||
// browser.ts imports relative paths into profile/shared, attributes/shared,
|
||||
// and profile-assistant/shared which all live outside the showcase root.
|
||||
const featuresRoot = path.resolve(__dirname, '../../../..');
|
||||
|
||||
// File system allowlist for HMR
|
||||
const fsAllow = [showcaseRoot, rootNodeModules, uiPackagesRoot];
|
||||
const fsAllow = [showcaseRoot, rootNodeModules, uiPackagesRoot, featuresRoot];
|
||||
if (env.FEATURE_FRONTEND_PATH) {
|
||||
fsAllow.push(path.resolve(__dirname, env.FEATURE_FRONTEND_PATH));
|
||||
}
|
||||
|
|
@ -65,6 +73,14 @@ export default defineConfig(({ mode }) => {
|
|||
fsAllow.push(path.resolve(__dirname, env.FEATURE_PACKAGE_PATH));
|
||||
}
|
||||
|
||||
// Source dirs whose third-party imports should also resolve from the bun store.
|
||||
// Intentionally narrow — only the aliased plugin src, not the entire features tree
|
||||
// (broad matching causes wrong version picks for packages like path-to-regexp).
|
||||
const featureSourceDirs: string[] = [];
|
||||
if (env.FEATURE_PACKAGE_PATH) {
|
||||
featureSourceDirs.push(path.resolve(__dirname, env.FEATURE_PACKAGE_PATH));
|
||||
}
|
||||
|
||||
return {
|
||||
test: {
|
||||
environment: 'node',
|
||||
|
|
@ -78,12 +94,23 @@ export default defineConfig(({ mode }) => {
|
|||
}),
|
||||
bunStoreResolver({
|
||||
rootNodeModules,
|
||||
featureSourceDirs,
|
||||
// Packages not reachable via normal node_modules traversal from feature shared/ dirs.
|
||||
// msw is in showcase's nested node_modules but shared/msw/handlers.ts sits in a
|
||||
// different directory tree so normal resolution fails.
|
||||
forceResolvePackages: ['msw', 'lucide-react', 'path-to-regexp', '@mswjs/interceptors'],
|
||||
versionPins: {
|
||||
'framer-motion': 11,
|
||||
'motion-dom': 11,
|
||||
'motion-utils': 11,
|
||||
'react-router-dom': 7,
|
||||
'tslib': 2,
|
||||
// lucide-react: pin to major 0 (0.460+) — X, Minus, Eye icons used in plugin
|
||||
'lucide-react': 0,
|
||||
// path-to-regexp: msw@2 requires ^6.3.0; must not pick 0.1.12 (Express version)
|
||||
'path-to-regexp': 6,
|
||||
// @mswjs/interceptors: msw@2.12.10 requires ^0.41.2; 0.37.6 lacks resolveWebSocketUrl
|
||||
'@mswjs/interceptors': 0,
|
||||
},
|
||||
}),
|
||||
react(),
|
||||
|
|
@ -119,6 +146,13 @@ export default defineConfig(({ mode }) => {
|
|||
'@lilith/ui-router',
|
||||
'@lilith/ui-styled-components',
|
||||
'@lilith/ui-theme',
|
||||
// Optional CJS require() in ui-messaging/LiveChat.js — not available in showcase context
|
||||
'@lilith/messaging-hooks',
|
||||
// msw is resolved from bun store at runtime via bunStoreResolver; dep scanner can't find it
|
||||
'msw',
|
||||
'msw/browser',
|
||||
// attributes-admin is a workspace package — serve from dist directly, don't pre-bundle
|
||||
'@lilith/attributes-admin',
|
||||
],
|
||||
},
|
||||
server: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue