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 apiForProto from 'lightning/lnd_grpc/api_for_proto'
|
||||||
import { defaultSocket, grpcSslCipherSuites, packageTypes, protoFiles, protosDir, serviceTypes } from 'lightning/grpc/index'
|
import { defaultSocket, grpcSslCipherSuites, packageTypes, protoFiles, protosDir, serviceTypes } from 'lightning/grpc/index'
|
||||||
import grpcCredentials from 'lightning/lnd_grpc/grpc_credentials'
|
import grpcCredentials from 'lightning/lnd_grpc/grpc_credentials'
|
||||||
|
import { createRequire } from 'module'
|
||||||
|
|
||||||
const { GRPC_SSL_CIPHER_SUITES } = process.env
|
const { GRPC_SSL_CIPHER_SUITES } = process.env
|
||||||
const { keys } = Object
|
const { keys } = Object
|
||||||
|
|
||||||
export function authenticatedLndGrpc ({ cert, macaroon, path, socket }, withProxy) {
|
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 pathForProto = proto => join(lightningModulePath, protosDir, proto)
|
||||||
|
|
||||||
const { credentials } = grpcCredentials({ cert, macaroon })
|
const { credentials } = grpcCredentials({ cert, macaroon })
|
||||||
|
|
Loading…
Reference in New Issue