File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -16,14 +16,18 @@ import { LIB_NAME, LIB_VERSION } from '@/src/version';
16
16
17
17
export const RAGSTACK_REQUESTED_WITH = ( ( ) => {
18
18
try {
19
- // eslint-disable-next-line @typescript-eslint/no-var-requires
20
- const ragstack = require ( '@datastax/ragstack-ai' ) ;
19
+ /**
20
+ * Do not use require() here, it will break the build in some environments such as NextJS application^M
21
+ * if @datastax/ragstack-ai is not installed (which is perfectly fine).
22
+ */
23
+ const ragstack = eval ( `require('@datastax/ragstack-ai')` ) ;
21
24
const version = ragstack [ 'RAGSTACK_VERSION' ] || "?" ;
22
25
return `ragstack-ai-ts/${ version } `
23
26
} catch ( e ) {
24
27
return '' ;
25
28
}
26
29
} ) ( ) ;
30
+ console . log ( "RAGSTACK_REQUESTED_WITH" , RAGSTACK_REQUESTED_WITH )
27
31
28
32
/**
29
33
* @internal
You can’t perform that action at this time.
0 commit comments