Skip to content

Commit

Permalink
fix: fix require
Browse files Browse the repository at this point in the history
  • Loading branch information
skyoct committed Nov 8, 2023
1 parent 367df85 commit 260e05b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtimes/nodejs/src/support/engine/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createRequire } from 'node:module';
export class FunctionModule {
private static cache: Map<string, any> = new Map()

private static customRequire: any
private static customRequire: any = null

static get(functionName: string): any {
const moduleName = `@/${functionName}`
Expand Down Expand Up @@ -58,9 +58,9 @@ export class FunctionModule {
const customName = Config.APP_CUSTOM_DEPENDENCIES_PATH + name
if (fs.existsSync(customName)) {
if (!FunctionModule.customRequire) {
this.customRequire = createRequire(Config.APP_CUSTOM_DEPENDENCIES_PATH)
FunctionModule.customRequire = createRequire(Config.APP_CUSTOM_DEPENDENCIES_PATH)
}
return this.customRequire(name)
return FunctionModule.customRequire(name)
}

return require(name)
Expand Down

0 comments on commit 260e05b

Please sign in to comment.