File tree Expand file tree Collapse file tree 1 file changed +30
-9
lines changed Expand file tree Collapse file tree 1 file changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -6,26 +6,47 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
66
77export default defineConfig ( {
88 build : {
9+ // Run this as a Node lib, not a browser bundle
10+ target : 'node16' ,
11+ platform : 'node' ,
12+
913 lib : {
1014 entry : resolve ( __dirname , 'dist/index.mjs' ) ,
1115 name : 'OpenAIAgentsRealtime' ,
12- // the proper extensions will be added
1316 fileName : 'openai-realtime-agents' ,
17+ // only emit ESM (remove 'umd' which is the default 3rd format)
18+ formats : [ 'es' ] ,
1419 } ,
20+
1521 sourcemap : 'inline' ,
22+
1623 rollupOptions : {
17- // make sure to externalize deps that shouldn't be bundled
18- // into your library
19- external : [ ] ,
24+ // Externalize all Node built-ins & optional SDK
25+ external : ( id ) => {
26+ if ( id . startsWith ( 'node:' ) ) return true ;
27+ const builtins = [
28+ 'fs' ,
29+ 'path' ,
30+ 'events' ,
31+ 'stream' ,
32+ 'stream/web' ,
33+ 'async_hooks' ,
34+ 'timers' ,
35+ 'crypto' ,
36+ 'child_process' ,
37+ ] ;
38+ if ( builtins . includes ( id ) ) return true ;
39+ if ( id === '@modelcontextprotocol/sdk' || id === 'cross-spawn' )
40+ return true ;
41+ return false ;
42+ } ,
43+
2044 output : {
2145 dir : 'dist/bundle' ,
2246 banner : '/** OpenAI Agents Realtime **/' ,
2347 minifyInternalExports : false ,
24- // Provide global variables to use in the UMD build
25- // for externalized deps
26- globals : {
27- // vue: 'Vue',
28- } ,
48+ // no need for UMD globals now since we’re not building UMD
49+ globals : { } ,
2950 } ,
3051 } ,
3152 } ,
You can’t perform that action at this time.
0 commit comments