Skip to content

Commit

Permalink
fix: do not use import on package.json (#1932)
Browse files Browse the repository at this point in the history
* fix: do not use import on package.json

* add additional logic around require for package.json

* fix path
  • Loading branch information
ddelgrosso1 authored May 16, 2022
1 parent d38dc73 commit d0f0494
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/nodejs-common/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ import {Duplex, DuplexOptions, Readable, Transform, Writable} from 'stream';
import {teenyRequest} from 'teeny-request';
import {Interceptor} from './service-object';
import * as uuid from 'uuid';
import * as packageJson from '../../package.json';
let packageJson: ReturnType<JSON['parse']> = {};
try {
// if requiring from 'build' (default)
packageJson = require('../../../package.json');
} catch (e) {
// if requiring directly from TypeScript context
packageJson = require('../../package.json');
}

// eslint-disable-next-line @typescript-eslint/no-var-requires
const duplexify: DuplexifyConstructor = require('duplexify');
Expand Down

0 comments on commit d0f0494

Please sign in to comment.