From d0626405a9193f9d6201bc77ab71209cfaa94e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Kiss?= Date: Mon, 9 Sep 2019 22:14:34 +0200 Subject: [PATCH] fix: es6 module loading (#1036) The modification helps to handle correctly the ES6 default exports. The firmware upgrade run correctly in the electron version and kboot-firmware-upgrade.ts script --- packages/uhk-usb/src/util.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/uhk-usb/src/util.ts b/packages/uhk-usb/src/util.ts index 5048ad33..9c86cf6c 100644 --- a/packages/uhk-usb/src/util.ts +++ b/packages/uhk-usb/src/util.ts @@ -1,7 +1,7 @@ import { Device, devices } from 'node-hid'; import { readFile } from 'fs-extra'; import { EOL } from 'os'; -import MemoryMap from 'nrf-intel-hex'; +import * as MemoryMap from 'nrf-intel-hex'; import { LogService } from 'uhk-common'; import { Constants, UsbCommand } from './constants'; @@ -126,7 +126,9 @@ export const getFileContentAsync = async (filePath: string): Promise> => { const fileContent = await readFile(hexFilePath, { encoding: 'utf8' }); - const memoryMap = MemoryMap.fromHex(fileContent); + const fromHex = MemoryMap.fromHex ? MemoryMap.fromHex : MemoryMap.default.fromHex; + + const memoryMap = fromHex(fileContent); return memoryMap; };