File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,7 +69,9 @@ export async function run(options: Options) {
6969
7070 const dialect = await createDialect ( provider , databaseUrl ! , outputPath ) ;
7171
72- const jiti = createJiti ( import . meta. url ) ;
72+ const fileUrl = typeof __filename !== 'undefined' ? __filename : import . meta. url ;
73+
74+ const jiti = createJiti ( fileUrl ) ;
7375
7476 const schemaModule = ( await jiti . import ( path . join ( outputPath , 'schema' ) ) ) as any ;
7577
@@ -92,6 +94,7 @@ export async function run(options: Options) {
9294 dialect : dialect ,
9395 log : log && log . length > 0 ? log : undefined ,
9496 omit : Object . keys ( omit ) . length > 0 ? omit : undefined ,
97+ skipValidationForComputedFields : true ,
9598 } ) ;
9699
97100 // check whether the database is reachable
Original file line number Diff line number Diff line change @@ -10,4 +10,9 @@ export default defineConfig({
1010 clean : true ,
1111 dts : true ,
1212 format : [ 'esm' , 'cjs' ] ,
13+ esbuildOptions : ( options ) => {
14+ options . logOverride = {
15+ 'empty-import-meta' : 'silent' ,
16+ } ;
17+ } ,
1318} ) ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export class ClientImpl {
7575 ...this . $options . functions ,
7676 } ;
7777
78- if ( ! baseClient ) {
78+ if ( ! baseClient && ! options . skipValidationForComputedFields ) {
7979 // validate computed fields configuration once for the root client
8080 this . validateComputedFieldsConfig ( ) ;
8181 }
Original file line number Diff line number Diff line change @@ -203,6 +203,11 @@ export type ClientOptions<Schema extends SchemaDef> = QueryOptions<Schema> & {
203203 * Defaults to `true`.
204204 */
205205 useCompactAliasNames ?: boolean ;
206+
207+ /**
208+ * Whether to skip validation for computed fields.
209+ */
210+ skipValidationForComputedFields ?: boolean ;
206211} & ( HasComputedFields < Schema > extends true
207212 ? {
208213 /**
You can’t perform that action at this time.
0 commit comments