Uncaught TypeError: fontmetrics_1.default не является функцией - PullRequest
0 голосов
/ 28 сентября 2019

Я получаю ошибку

Uncaught TypeError: fontmetrics_1.default is not a function

в моем проекте машинопись + электрон.package.json:

  "dependencies": {
  "fontmetrics": "^1.0.0",
  "rxjs": "^6.3.3"
 }

tsconfig.json

{
"compilerOptions": {
    "module": "commonjs",
    "removeComments": true,
    "preserveConstEnums": true,
    "outDir": "./build/js",
    "sourceMap": true,
    "moduleResolution": "Node",
    "target": "es2015"
},
"include": [
    "src/**/*"
],
"exclude": [
    "src/ts/tests/**/*"
]
}

в моем коде:

import FontMetrics from "fontmetrics";
[...]
const metrics = FontMetrics({
        fontFamily: 'Roboto',
        // Optional (defaults)
        fontWeight: 'normal',
        fontSize: "14px",
        origin: 'baseline'
    });

эта строка (const metrics = ...) являетсяСтрока, где происходит исключение.

Кто-нибудь знает, как это исправить?

...