fix require is not defined in ES module scope
This commit is contained in:
		
							parent
							
								
									048c27fa7e
								
							
						
					
					
						commit
						571a230b3c
					
				@ -5,12 +5,15 @@ import { join } from 'path'
 | 
			
		||||
import apiForProto from 'lightning/lnd_grpc/api_for_proto'
 | 
			
		||||
import { defaultSocket, grpcSslCipherSuites, packageTypes, protoFiles, protosDir, serviceTypes } from 'lightning/grpc/index'
 | 
			
		||||
import grpcCredentials from 'lightning/lnd_grpc/grpc_credentials'
 | 
			
		||||
import { createRequire } from 'module'
 | 
			
		||||
 | 
			
		||||
const { GRPC_SSL_CIPHER_SUITES } = process.env
 | 
			
		||||
const { keys } = Object
 | 
			
		||||
 | 
			
		||||
export function authenticatedLndGrpc ({ cert, macaroon, path, socket }, withProxy) {
 | 
			
		||||
  const lightningModulePath = require.resolve('lightning')
 | 
			
		||||
  const req = createRequire(import.meta.url)
 | 
			
		||||
 | 
			
		||||
  const lightningModulePath = req.resolve('lightning')
 | 
			
		||||
  const pathForProto = proto => join(lightningModulePath, protosDir, proto)
 | 
			
		||||
 | 
			
		||||
  const { credentials } = grpcCredentials({ cert, macaroon })
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user