105 lines
3.2 KiB
JavaScript
105 lines
3.2 KiB
JavaScript
import { defineConfig } from 'tsup';
|
|
|
|
export default defineConfig([
|
|
// Main bundled files
|
|
{
|
|
entry: [
|
|
'src/index.js',
|
|
'src/features/auth/index.js',
|
|
'src/features/auth/actions.js',
|
|
'src/features/auth/pages.js',
|
|
'src/features/auth/components/index.js',
|
|
'src/features/admin/index.js',
|
|
'src/features/admin/actions.js',
|
|
'src/features/admin/pages.js',
|
|
'src/features/admin/components/index.js',
|
|
'src/core/api/index.js',
|
|
'src/core/api/nx-route.js',
|
|
'src/core/database/index.js',
|
|
'src/core/database/cli.js',
|
|
'src/features/setup/index.js',
|
|
'src/features/setup/cli.js',
|
|
'src/core/email/index.js',
|
|
'src/core/email/templates/index.js',
|
|
'src/core/storage/index.js',
|
|
'src/core/toast/index.js',
|
|
'src/features/provider/index.js',
|
|
'src/core/modules/index.js',
|
|
'src/core/modules/client.js',
|
|
'src/modules/index.js',
|
|
'src/modules/init.js',
|
|
'src/modules/pages.js',
|
|
'src/modules/modules.metadata.js',
|
|
// Module actions, API and CRUD (bundled to resolve relative imports)
|
|
'src/modules/*/actions.js',
|
|
'src/modules/*/api.js',
|
|
'src/modules/*/crud.js',
|
|
'src/modules/**/statsActions.js',
|
|
'src/modules/invoice/dashboard/index.js',
|
|
'src/modules/nuage/dashboard/index.js',
|
|
'src/shared/lib/metadata/index.js',
|
|
],
|
|
format: ['esm'],
|
|
dts: false,
|
|
splitting: false,
|
|
sourcemap: false,
|
|
clean: true,
|
|
external: ['react', 'react-dom', 'next', 'pg', 'dotenv', 'dotenv/config', 'resend', '@react-email/components', 'node-cron', 'readline', 'crypto', 'url', 'fs', 'path', 'net', 'dns', 'tls', '@hykocx/zen/database', '@hykocx/zen/email', '@hykocx/zen/email/templates', '@hykocx/zen/storage', '@hykocx/zen/toast', '@hykocx/zen/modules/actions', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner'],
|
|
noExternal: [],
|
|
bundle: true,
|
|
banner: {
|
|
js: ``,
|
|
},
|
|
esbuildOptions(options) {
|
|
options.loader = {
|
|
'.js': 'jsx',
|
|
'.jsx': 'jsx',
|
|
};
|
|
options.jsx = 'automatic';
|
|
options.platform = 'neutral';
|
|
options.legalComments = 'inline';
|
|
},
|
|
},
|
|
// Page wrappers and server-only files - NOT bundled to preserve boundaries and share instances
|
|
{
|
|
entry: [
|
|
'src/features/auth/page.js',
|
|
'src/features/admin/page.js',
|
|
'src/features/admin/navigation.server.js',
|
|
'src/modules/page.js',
|
|
'src/modules/modules.actions.js',
|
|
],
|
|
format: ['esm'],
|
|
dts: false,
|
|
splitting: false,
|
|
sourcemap: false,
|
|
clean: false, // Don't clean, we already did in first config
|
|
external: [
|
|
'react',
|
|
'react-dom',
|
|
'next',
|
|
'@hykocx/zen',
|
|
'@hykocx/zen/auth/pages',
|
|
'@hykocx/zen/auth/actions',
|
|
'@hykocx/zen/admin',
|
|
'@hykocx/zen/admin/pages',
|
|
'@hykocx/zen/admin/actions',
|
|
'@hykocx/zen/admin/navigation',
|
|
'@hykocx/zen/toast',
|
|
'@hykocx/zen/core/modules',
|
|
'@hykocx/zen/modules/pages',
|
|
'@hykocx/zen/modules/actions',
|
|
'@hykocx/zen/modules/metadata',
|
|
],
|
|
bundle: false, // Don't bundle these files
|
|
esbuildOptions(options) {
|
|
options.loader = {
|
|
'.js': 'jsx',
|
|
'.jsx': 'jsx',
|
|
};
|
|
options.jsx = 'automatic';
|
|
},
|
|
},
|
|
]);
|
|
|