From de1a11f8c764c33f40982842a370385edd6da2ad Mon Sep 17 00:00:00 2001 From: JonasBa Date: Mon, 2 Dec 2024 16:20:17 -0500 Subject: [PATCH] define main and module --- .github/workflows/build.yml | 8 ++++---- .../test-applications/node-profiling/index.mjs | 13 ++++++++----- packages/profiling-node/package.json | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2773c5943052..7046b309db7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1411,6 +1411,10 @@ jobs: key: ${{ needs.job_build.outputs.dependency_cache_key }} enableCrossOsArchive: true + - name: Increase yarn network timeout on Windows + if: contains(matrix.os, 'windows') + run: yarn config set network-timeout 600000 -g + - name: Install dependencies env: SKIP_PLAYWRIGHT_BROWSER_INSTALL: "1" @@ -1421,10 +1425,6 @@ jobs: run: | git config --global --add safe.directory "*" - - name: Increase yarn network timeout on Windows - if: contains(matrix.os, 'windows') - run: yarn config set network-timeout 600000 -g - - name: Setup python uses: actions/setup-python@v5 if: ${{ !contains(matrix.container, 'alpine') }} diff --git a/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs b/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs index 6ab088e13d4a..48f7e37f701e 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs +++ b/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs @@ -1,21 +1,24 @@ // This tests asserts that @sentr/profiling-node is not patching globalThis values, which // breaks our runtime detection and can break instrumentation // https://github.com/getsentry/sentry-javascript/issues/14525#issuecomment-2511208064 +import * as Sentry from '@sentry/node'; +import { nodeProfilingIntegration } from '@sentry/profiling-node'; + +console.log('🧵 Starting ESM test'); + +const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); function assertUnpatechedRequire() { - if (typeof globalThis.require !== 'undefined') { + if (typeof require !== 'undefined') { // Test that globalThis.require is not defined by any side effects of the profiling // https://github.com/getsentry/sentry-javascript/issues/13662 throw new Error( `globalThis.require should not be defined, check that profiling integration is not defining it, received: ` + - typeof globalThis.require, + typeof require, ); } } -import * as Sentry from '@sentry/node'; -import { nodeProfilingIntegration } from '@sentry/profiling-node'; -const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); Sentry.init({ dsn: 'https://7fa19397baaf433f919fbe02228d5470@o1137848.ingest.sentry.io/6625302', diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index 3f2e630fc304..94f0258aff49 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -7,6 +7,7 @@ "author": "Sentry", "license": "MIT", "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "types": "lib/types/index.d.ts", "exports": { "./package.json": "./package.json",