- Externalize all @tamagui/* and tamagui subpaths so dist no longer vendors Tamagui. - Emit TypeScript declarations with vite-plugin-dts; fix package exports types for ui/*. - Align initEnv with profiles: displayName, brandLogo, api.baseURL, themeColor, uiShell. - Stabilize tests with Node localStorage file; env tests pass. - Update README and component docs for services, menus, API client, and development.
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
/** Keep peer/runtime deps out of published dist (including subpaths like @tamagui/config/v3). */
|
|
function isExternal(id) {
|
|
if (id === 'react' || id === 'react/jsx-runtime' || id === 'react-dom' || id === 'react-dom/client') {
|
|
return true;
|
|
}
|
|
if (id === 'tamagui' || id.startsWith('tamagui/')) return true;
|
|
if (id.startsWith('@tamagui/')) return true;
|
|
return false;
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
tsconfigPath: './tsconfig.json',
|
|
insertTypesEntry: true,
|
|
include: ['src/**/*.js', 'src/**/*.jsx'],
|
|
exclude: ['**/*.test.*', '**/test/**']
|
|
})
|
|
],
|
|
build: {
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/index.js'),
|
|
formats: ['es']
|
|
},
|
|
rollupOptions: {
|
|
external: isExternal,
|
|
output: {
|
|
// Preserve module structure - automatically preserves directory structure
|
|
preserveModules: true,
|
|
preserveModulesRoot: 'src',
|
|
// Use original file names and paths
|
|
entryFileNames: '[name].js',
|
|
chunkFileNames: '[name].js'
|
|
}
|
|
},
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
sourcemap: true
|
|
}
|
|
});
|
|
|