-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathesbuild.config.js
More file actions
64 lines (62 loc) · 1.57 KB
/
esbuild.config.js
File metadata and controls
64 lines (62 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { build } from 'esbuild';
// ESBuild configuration to handle problematic ES module dependencies
await build({
entryPoints: ['server/index.ts'],
bundle: true,
platform: 'node',
target: 'node18',
format: 'esm',
outdir: 'dist',
packages: 'external', // Keep packages external but handle DIMO SDK specially
external: [
// Common Node.js dependencies that should stay external
'express',
'fs',
'path',
'url',
'util',
'os',
'crypto',
'stream',
'buffer',
'http',
'https',
'events',
'zlib',
'querystring',
// Database and session dependencies
'@neondatabase/serverless',
'drizzle-orm',
'memorystore',
'connect-pg-simple',
'passport',
'passport-local',
'express-session',
// Problematic build tools
'lightningcss',
'@babel/*',
'esbuild',
'*.node'
],
// Force bundling of DIMO SDK to resolve ES module issues
packages: 'external',
keepNames: true,
minify: false,
define: {
'import.meta.url': 'import.meta.url'
},
conditions: ['import', 'module', 'node'],
mainFields: ['module', 'main'],
resolveExtensions: ['.ts', '.js', '.mjs'],
// Handle specific problematic imports with plugins
plugins: [{
name: 'dimo-sdk-resolver',
setup(build) {
// Handle the problematic directory import
build.onResolve({ filter: /@dimo-network\/data-sdk\/dist\/api$/ }, args => {
return { path: '@dimo-network/data-sdk', external: false };
});
}
}]
});
console.log('Build completed successfully with ES module compatibility fixes');