Skip to content

Debugger does not respect tsconfig files in a monorepo environment with yarn berry pnp and workspaces #114258

@valdestron

Description

@valdestron
  • VSCode Version: November 2020 (version 1.52)
  • OS Version: macOS Catalina

Steps to Reproduce:

  1. use yarn v2 (berry) pnp
  2. setup base tsconfig, and then tsconfig per folder
    root tsconfig.base.json
{
  "compilerOptions": {
    "pretty": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "target": "esnext",
    "lib": ["esnext", "esnext.asynciterable"],
    "moduleResolution": "node",
    "declaration": true,
    "inlineSourceMap": true,
		"inlineSources": true,
		"importHelpers": true,
		"downlevelIteration": false,
		"alwaysStrict": true,
		"strict": true,
		"strictNullChecks": true,
		"strictFunctionTypes": true,
		"strictBindCallApply": true,
		"strictPropertyInitialization": true,
    "noStrictGenericChecks": false,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
		"noImplicitThis": false,
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		/* Report error when not all code paths in function return a value. */
    "noImplicitReturns": true,
		/* Report errors for fallthrough cases in switch statement. */
    "noFallthroughCasesInSwitch": false,
    /* Resolve 'keyof' to string valued property names only (no numbers or symbols). */
    "keyofStringsOnly": true,
    /* Do not report errors on unreachable code */
    "allowUnreachableCode": true,
    /* Do not report errors on unused labels. */
    "allowUnusedLabels": false,
    "useDefineForClassFields": false,
    "baseUrl": ".",
		"allowSyntheticDefaultImports": true,
		/* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "esModuleInterop": true,
		"allowUmdGlobalAccess": true,
    "experimentalDecorators": true,
		/* Enables experimental support for emitting type metadata for decorators. */
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
  }
}

tsconfg.json in workspace folder

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "rootDir": "src",
    "outDir": "dist",
    "paths": {
      "*": ["*"]
    },
    "experimentalDecorators": true
  },
  "include": [
    "./src/**/*"
  ],
  "exclude" : ["./src/**/*.spec.ts", "./src/**/*.test.ts"],
}
  1. setup debugger configuration for the workspace folder
    {
        "type": "pwa-node",
        "request": "launch",
        "name": "svc: workflows",
        "runtimeArgs": ["-r", "./.pnp.js", "-r", "ts-node/register"],
        "skipFiles": ["<node_internals>/**", "node_modules/**"],
        "args": ["${workspaceFolder}/services/workflows/src/index.ts"]
    }
  1. .yarnrc.yml
networkConcurrency: 16

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: "@yarnpkg/plugin-typescript"
  - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
    spec: "@yarnpkg/plugin-workspace-tools"
  - path: .yarn/plugins/@yarnpkg/plugin-exec.cjs
    spec: "@yarnpkg/plugin-exec"
  - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
    spec: "@yarnpkg/plugin-interactive-tools"
  - path: .yarn/plugins/@ojkelly/plugin-build.cjs
    spec: "https://github.com/ojkelly/yarn.build/releases/download/v0.9.53/plugin-build.js"

yarnPath: .yarn/releases/yarn-2.4.0.cjs


packageExtensions:
  react-dev-utils@*:
    peerDependencies:
      webpack: ^4.0.0
      typescript: ^2.7.0 
  "@node-ts/logger-core@*":
    dependencies:
      tslib: "^2.0.0"
  "@node-ts/logger-winston@*":
    dependencies:
      tslib: "^2.0.0"
  1. try to run debugger
    error:
/usr/local/bin/node -r ./.pnp.js -r ts-node/register /Users/valdestron/Projects/xxx/xxx-mgmt/services/workflows/src/index.ts
/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:513
    return new TSError(diagnosticText, diagnosticCodes)
           ^
.yarn/cache/source-map-support-npm-0.5.19-65b33ae61e-59d4efaae9.zip/node_modules/source-map-support/source-map-support.js:475
TSError: ⨯ Unable to compile TypeScript:
services/workflows/src/utils/injectableLogger.ts(10,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.

    at createTSError (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:513:12)
    at reportTSError (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:517:19)
    at getOutput (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:752:36)
    at Object.compile (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:968:32)
    at Module.m._compile (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:1056:42)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/valdestron/Projects/xxx/xxx-mgmt/.yarn/$$virtual/ts-node-virtual-259999f22d/0/cache/ts-node-npm-9.1.0-a67f8fc398-4735671aab.zip/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.external_module_.Module._load (/Users/valdestron/Projects/xxx/xxx-mgmt/.pnp.js:29848:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
.yarn/cache/source-map-support-npm-0.5.19-65b33ae61e-59d4efaae9.zip/node_modules/source-map-support/source-map-support.js:478
Process exited with code 1

Additional info

At first I created a related issue yarnpkg/berry#2366
Either I don't know how to source tsconfig in debugger configuration in such environment, or its a bug.

Metadata

Metadata

Assignees

Labels

debugDebug viewlet, configurations, breakpoints, adapter issuesinfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions