From 353c15cbd50ca9adebfe933b713f6775aa68c176 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Tue, 15 Jun 2021 17:15:31 +0200 Subject: [PATCH] fix: esm import for source-map-support --- .github/workflows/test-and-release.yml | 2 +- package.json | 1 + packages/zwave-js/src/index.ts | 8 +++++--- yarn.lock | 11 +++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 836cf2683b95..a49da9f304c7 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -181,7 +181,7 @@ jobs: - if: matrix.node-version != '10.x' name: Import main entry point (ESM) - run: node --input-type=module -e 'import "./packages/zwave-js"' + run: node --input-type=module --es-module-specifier-resolution=node -e 'import "zwave-js"' - name: Run component tests run: yarn run test:ci diff --git a/package.json b/package.json index 6e14f134d37a..feddd163a158 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@types/prettier": "^2.2.3", "@types/semver": "^7.3.6", "@types/serialport": "^8.0.1", + "@types/source-map-support": "^0.5.3", "@types/triple-beam": "^1.3.2", "@types/xml2json": "^0.11.3", "@types/yargs": "^16.0.1", diff --git a/packages/zwave-js/src/index.ts b/packages/zwave-js/src/index.ts index b4360a380583..525e43724a90 100644 --- a/packages/zwave-js/src/index.ts +++ b/packages/zwave-js/src/index.ts @@ -3,11 +3,13 @@ // This module is the main entry point. Requiring reflect-metadata here avoids forgetting it import "reflect-metadata"; -import * as path from "path"; // By installing source map support, we get the original source // locations in error messages -import "source-map-support/register"; -import { initSentry } from "./lib/telemetry/sentry"; +import { install as installSourceMapSupport } from "source-map-support"; +installSourceMapSupport(); + +import * as path from "path"; +import { initSentry } from "./lib/telemetry/sentry.js"; /** The version of zwave-js, exported for your convenience */ const packageJsonPath = require.resolve("zwave-js/package.json"); diff --git a/yarn.lock b/yarn.lock index 452356ff7748..9a6a0a234535 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2992,6 +2992,13 @@ dependencies: "@types/node" "*" +"@types/source-map-support@^0.5.3": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.5.3.tgz#acb6b3e499c20692552d16934c16162c84594e16" + integrity sha512-fvjMjVH8Rmokw2dWh1dkj90iX5R8FPjeZzjNH+6eFXReh0QnHFf1YBl3B0CF0RohIAA3SDRJsGeeUWKl6d7HqA== + dependencies: + source-map "^0.6.0" + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -5302,7 +5309,7 @@ fs-extra@8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.0, fs-extra@^9.0.1: +fs-extra@^9.0.0: version "9.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc" integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ== @@ -5312,7 +5319,7 @@ fs-extra@^9.0.0, fs-extra@^9.0.1: jsonfile "^6.0.1" universalify "^1.0.0" -fs-extra@^9.1.0: +fs-extra@^9.0.1, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==