fix: add crypto polyfill to next standalone server loader for Node 18 compatibility

This commit is contained in:
rafif committed 2026-07-23 17:55:41 +07:00
1 parent e975ea788e
commit f0876face0
1 file changed
+4
+4
View File
@@ -23,6 +23,10 @@ function exec(conn, cmd, label) {
// Konten start-with-env.js yang akan ditulis ke server
const startWithEnvContent = `'use strict';
// Polyfill global crypto for Node 18 compatibility (required by mongodb driver)
if (typeof globalThis.crypto === 'undefined') {
globalThis.crypto = require('crypto');
}
/**
* BackOne DPI - Safe Environment Loader for Next.js Standalone
* Reads .env.production safely without bash glob expansion issues.