Add security/index, security/model/index, security/policy/index, and security/pages/index as explicit lib entries. Under preserveModules these re-export barrels were never reachable from an entry (internal code imports the concrete files directly), so dist shipped only their .d.ts and consumer imports like `@reliancy/bface/security/model/index.js` failed to resolve. Not republished; picked up on the next release. Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.4 KiB
JavaScript
65 lines
2.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 === '@phosphor-icons/react' || id.startsWith('@phosphor-icons/react/')) 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: {
|
|
index: path.resolve(__dirname, 'src/index.js'),
|
|
'ui/components/index': path.resolve(__dirname, 'src/ui/components/index.js'),
|
|
'ui/route-loading': path.resolve(__dirname, 'src/ui/route-loading.js'),
|
|
'ui/pages/SettingsPage': path.resolve(__dirname, 'src/ui/pages/SettingsPage.jsx'),
|
|
// Barrel entries: these are pure re-export modules that internal code never
|
|
// imports (it imports the concrete files directly), so under preserveModules
|
|
// they are otherwise omitted from dist (only .d.ts emitted), breaking consumer
|
|
// imports like `@reliancy/bface/security/model/index.js`.
|
|
'security/index': path.resolve(__dirname, 'src/security/index.js'),
|
|
'security/model/index': path.resolve(__dirname, 'src/security/model/index.js'),
|
|
'security/policy/index': path.resolve(__dirname, 'src/security/policy/index.js'),
|
|
'security/pages/index': path.resolve(__dirname, 'src/security/pages/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
|
|
}
|
|
});
|
|
|