Skip to content

Commit

Permalink
fix(runtime): fix process.env hot reload (labring#1709)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Nov 24, 2023
1 parent 670ab2c commit 7ef87f5
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 70 deletions.
151 changes: 91 additions & 60 deletions runtimes/nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runtimes/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@types/lodash": "^4.14.171",
"@types/mongodb-uri": "^0.9.1",
"@types/multer": "^1.4.5",
"@types/node": "^18.11.15",
"@types/node": "^20.9.5",
"@types/nodemailer": "^6.4.4",
"@types/validator": "^13.1.3",
"@types/ws": "^8.5.3",
Expand Down
4 changes: 1 addition & 3 deletions runtimes/nodejs/src/support/cloud-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ function createCloudSdk() {
sockets: WebSocketAgent.clients,
appid: Config.APPID,
get env() {
return {
...process.env,
}
return process.env
},
}

Expand Down
4 changes: 1 addition & 3 deletions runtimes/nodejs/src/support/engine/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ export class FunctionModule {
clearInterval: clearInterval,
setTimeout: setTimeout,
clearTimeout: clearTimeout,
process: {
env: { ...process.env },
},
process: process,
URL: URL,
fetch: globalThis.fetch,
global: null,
Expand Down
4 changes: 1 addition & 3 deletions runtimes/nodejs/src/support/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export interface FunctionModuleGlobalContext {
Float32Array: typeof Float32Array
__filename: string
URL: typeof URL
process: {
env: { [key: string]: string }
}
process: NodeJS.Process
global: FunctionModuleGlobalContext
__from_modules: string[]
fetch: typeof globalThis.fetch
Expand Down

0 comments on commit 7ef87f5

Please sign in to comment.