getsentry / profiling-node

The code for this repo now lives in https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node
MIT License
29 stars 10 forks source link

"Duplicate Declaration Error: 'DEBUG_BUILD' Variable in '@sentry/types'" #158

Closed Yusadolat closed 1 year ago

Yusadolat commented 1 year ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

SDK Version

0.3.0

Link to Sentry event

No response

What environment is your node script running in?

Express(Typescript)

How is your code deployed and bundled?

tsc -p tsconfig.production.json

Steps to Reproduce

  1. Install npm install --save @sentry/node @sentry/profiling-node
  2. Add the integration
  3. the run to compile

NodeJS version: 16.14.2

Expected Result

It expected to compile without any issue

Actual Result

node_modules/@sentry/profiling-node/node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

2     const __DEBUG_BUILD__: boolean;
            ~~~~~~~~~~~~~~~

  node_modules/@sentry/types/types/globals.d.ts:2:11
    2     const __DEBUG_BUILD__: boolean;
                ~~~~~~~~~~~~~~~
    '__DEBUG_BUILD__' was also declared here.

node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

2     const __DEBUG_BUILD__: boolean;
            ~~~~~~~~~~~~~~~

  node_modules/@sentry/profiling-node/node_modules/@sentry/types/types/globals.d.ts:2:11
    2     const __DEBUG_BUILD__: boolean;
                ~~~~~~~~~~~~~~~
    '__DEBUG_BUILD__' was also declared here.

Found 2 errors.
JonasBa commented 1 year ago

@Yusadolat thanks for the report, would you mind sharing your tsconfig.production.json so we can see which compiler option triggers this?

Yusadolat commented 1 year ago

Sure, Below is the config.

//tsconfig.production.json
{
  "extends": "./tsconfig",
  "compilerOptions": {
    "sourceMap": true,
    "inlineSources": true,
    "sourceRoot": "/",
    "esModuleInterop": true
  }
}
//tsconfig.json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "downlevelIteration": true,
    "isolatedModules": false,
    "sourceMap": true,
    "module": "commonjs",
    "target": "es6",
    "lib": [ "ES2020.Promise", "es2019", "DOM", "ES6" ,"DOM.Iterable", "ScriptHost" ],
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "outDir": "build",
    "allowJs": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "esModuleInterop": true,
    "strictNullChecks": true,
    "baseUrl": ".",
    "paths": {
      "@application/*": ["src/application/*"],
      "@domain/*": ["src/domain/*"],
      "@dtos/*": ["src/dtos/*"],
      "@infrastructure/*": ["src/infrastructure/*"],
      "@shared/*": ["src/shared/*"],
      "@test-application/*": ["test/application/*"],
      "@test-domain/*": ["test/domain/*"],
      "@test-infrastructure/*": ["test/infrastructure/*"],
      "@utils/*": ["src/utils/*"],
      "@modules/*": ["src/modules/*"],
      "@auth/*": ["src/modules/auth/*"],
      "@warehousing/*": ["src/modules/warehousing/*"],
      "@machine-management/*": ["src/modules/machine-management/*"],
      "@notification/*": ["src/modules/notification/*"]
    }
  },
  "include": [
    "src",
    "src/application/*",
    "src/domain/*",
    "src/infrastructure/*",
    "test",
    "__mocks__",
    "scripts/globalTeardown.js"
  ],
  "exclude": [
    "node_modules",
    "build"
  ]
}
JonasBa commented 1 year ago

@Yusadolat mind upgrading to latest version and see if the error still happens?

JonasBa commented 1 year ago

Closing as we removed the __DEBUG_BUILD__ variable, but please feel free to reopen if this reappears