@@ -72,8 +72,9 @@ export class SharedProjectPlugin implements Plugin {
7272 if ( ! scopeId ) {
7373 throw new Error ( '[SharedProjectPlugin] scopeId (projectId) required for scoped metadata' ) ;
7474 }
75- // Dynamic import — @objectstack/metadata is a peer dep, not a hard dep of runtime
76- const metadataMod = await import ( '@objectstack/metadata' as string ) ;
75+ // Dynamic import — @objectstack/metadata is a peer dep, not a hard dep of runtime.
76+ // new Function prevents bundlers (Vite/Rolldown) from resolving this as a bare specifier.
77+ const metadataMod = await new Function ( 'm' , 'return import(m)' ) ( '@objectstack/metadata' ) ;
7778 const MetadataManager = metadataMod . MetadataManager ;
7879 const driver = await _ctx . getServiceScoped < any > ( 'driver' , scopeId ) ;
7980 const manager = new MetadataManager ( ) ;
@@ -91,8 +92,9 @@ export class SharedProjectPlugin implements Plugin {
9192 if ( ! scopeId ) {
9293 throw new Error ( '[SharedProjectPlugin] scopeId (projectId) required for scoped objectql' ) ;
9394 }
94- // Dynamic import — @objectstack/objectql is a peer dep, not a hard dep of runtime
95- const objectqlMod = await import ( '@objectstack/objectql' as string ) ;
95+ // Dynamic import — @objectstack/objectql is a peer dep, not a hard dep of runtime.
96+ // new Function prevents bundlers (Vite/Rolldown) from resolving this as a bare specifier.
97+ const objectqlMod = await new Function ( 'm' , 'return import(m)' ) ( '@objectstack/objectql' ) ;
9698 const ObjectQL = objectqlMod . ObjectQL ;
9799 const driver = await _ctx . getServiceScoped < any > ( 'driver' , scopeId ) ;
98100 const ql = new ObjectQL ( { logger : _ctx . logger } ) ;
0 commit comments