diff --git a/packages/grpc-js/src/index.ts b/packages/grpc-js/src/index.ts index 661e0efd..e4bb3658 100644 --- a/packages/grpc-js/src/index.ts +++ b/packages/grpc-js/src/index.ts @@ -62,7 +62,8 @@ import { ServerDuplexStream, } from './server-call'; -const supportedNodeVersions = require('../../package.json').engines.node; +import { engines as supportedEngines } from '../package.json'; +const supportedNodeVersions = supportedEngines.node; if (!semver.satisfies(process.version, supportedNodeVersions)) { throw new Error(`@grpc/grpc-js only works on Node ${supportedNodeVersions}`); } diff --git a/packages/grpc-js/src/subchannel.ts b/packages/grpc-js/src/subchannel.ts index 3f6cfd52..3f71720e 100644 --- a/packages/grpc-js/src/subchannel.ts +++ b/packages/grpc-js/src/subchannel.ts @@ -29,7 +29,7 @@ import { LogVerbosity } from './constants'; import { shouldUseProxy, getProxiedConnection } from './http_proxy'; import * as net from 'net'; -const { version: clientVersion } = require('../../package.json'); +import { version as clientVersion } from '../package.json'; const TRACER_NAME = 'subchannel'; diff --git a/packages/grpc-js/tsconfig.json b/packages/grpc-js/tsconfig.json index f60cbdc0..ba675db7 100644 --- a/packages/grpc-js/tsconfig.json +++ b/packages/grpc-js/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "build", "target": "es2017", "module": "commonjs", + "resolveJsonModule": true, "incremental": true }, "include": [