File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,12 @@ export class CdkFramework implements IFramework {
307307 `compiledCdk.${ isESM ? 'mjs' : 'cjs' } ` ,
308308 ) ;
309309
310+ const dirname = path . join (
311+ ...( [ getProjectDirname ( ) , config . subfolder , 'x' ] . filter (
312+ ( p ) => p ,
313+ ) as string [ ] ) ,
314+ ) ;
315+
310316 try {
311317 // Build CDK code
312318 await esbuild . build ( {
@@ -327,21 +333,15 @@ export class CdkFramework implements IFramework {
327333 `import { createRequire as topLevelCreateRequire } from 'module';` ,
328334 `global.require = global.require ?? topLevelCreateRequire(import.meta.url);` ,
329335 `import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"` ,
330- `global.__dirname = global.__dirname ?? topLevelFileUrlToPath(new topLevelURL(".", import.meta.url)) ` ,
336+ `global.__dirname = ' ${ dirname } ' ` ,
331337 ] . join ( '\n' ) ,
332338 } ,
333339 }
334340 : {
335341 format : 'cjs' ,
336342 target : 'node18' ,
337343 banner : {
338- js : [
339- `__dirname = '${ path . join (
340- ...( [ getProjectDirname ( ) , config . subfolder , 'x' ] . filter (
341- ( p ) => p ,
342- ) as string [ ] ) ,
343- ) } ';`,
344- ] . join ( '\n' ) ,
344+ js : [ `__dirname = '${ dirname } ';` ] . join ( '\n' ) ,
345345 } ,
346346 } ) ,
347347 } ) ;
You can’t perform that action at this time.
0 commit comments