microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.99k stars 12.48k forks source link

compilerOptions.plugins accepts missing plugins without any logging or error information #59575

Open tmcw opened 3 months ago

tmcw commented 3 months ago

🔎 Search Terms

compilerOptions, plugins, missing, module, plugin

🕗 Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAHjAvDAjAbiA

💻 Code

tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "missing"
      }
    ]
  }
}

🙁 Actual behavior

TypeScript doesn't produce any debugging hints, or an error, if compilerOptions.plugins includes a reference to a missing plugin.

🙂 Expected behavior

When a tsconfig contains a compilerOptions.plugins entry that points to a plugin that could not be found, TypeScript should log or produce an error saying that it couldn't be found.

Additional information about the issue

No response

RyanCavanaugh commented 3 months ago

It's in the TS Server log, but it's understandable you might want additional UI

Info 24   [09:33:13.302] Enabling plugin missing from candidate paths: c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/typescript/lib/typescript.js/../../..
Info 25   [09:33:13.302] Loading missing from c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/typescript/lib/typescript.js/../../.. (resolved to c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/node_modules)
Info 26   [09:33:13.313] Failed to load module 'missing' from c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/node_modules: Error: Could not resolve JS module 'missing' starting at 'c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/node_modules'. Looked in: c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/missing/package.json, c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/missing.js, c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/missing.jsx, c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/missing/index.js, c:/Users/ryanca/.vscode/extensions/ms-vscode.vscode-typescript-next-5.6.20240808/node_modules/missing/index.jsx, c:/Users/ryanca/.vscode/extensions/node_modules/missing/package.json, c:/Users/ryanca/.vscode/extensions/node_modules/missing.js, c:/Users/ryanca/.vscode/extensions/node_modules/missing.jsx, c:/Users/ryanca/.vscode/extensions/node_modules/missing/index.js, c:/Users/ryanca/.vscode/extensions/node_modules/missing/index.jsx, c:/Users/ryanca/.vscode/node_modules/missing/package.json, c:/Users/ryanca/.vscode/node_modules/missing.js, c:/Users/ryanca/.vscode/node_modules/missing.jsx, c:/Users/ryanca/.vscode/node_modules/missing/index.js, c:/Users/ryanca/.vscode/node_modules/missing/index.jsx, c:/Users/ryanca/node_modules/missing/package.json, c:/Users/ryanca/node_modules/missing.js, c:/Users/ryanca/node_modules/missing.jsx, c:/Users/ryanca/node_modules/missing/index.js, c:/Users/ryanca/node_modules/missing/index.jsx, c:/Users/node_modules/missing/package.json, c:/Users/node_modules/missing.js, c:/Users/node_modules/missing.jsx, c:/Users/node_modules/missing/index.js, c:/Users/node_modules/missing/index.jsx, c:/node_modules/missing/package.json, c:/node_modules/missing.js, c:/node_modules/missing.jsx, c:/node_modules/missing/index.js, c:/node_modules/missing/index.jsx
    at resolveJSModule (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:44182:11)
    at Object.require (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:8359:30)
    at _Project.importServicePluginSync (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:183120:27)
    at _ProjectService.requestEnablePlugin (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188769:16)
    at ConfiguredProject2.enablePlugin (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:184428:25)
    at ConfiguredProject2.enablePluginsWithOptions (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:185185:14)
    at _ProjectService.loadConfiguredProject (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:187015:13)
    at _ProjectService.reloadConfiguredProject (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:187266:10)
    at ConfiguredProject2.updateGraph (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:185114:29)
    at updateWithTriggerFile (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:185630:11)
    at updateConfiguredProject (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:185638:9)
    at _ProjectService.findCreateOrReloadConfiguredProject (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188126:44)
    at _ProjectService.tryFindDefaultConfiguredProjectForOpenScriptInfo (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188150:25)
    at _ProjectService.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188210:25)
    at _ProjectService.assignProjectToOpenedScriptInfo (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188081:27)
    at c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188510:25
    at Array.forEach (<anonymous>)
    at _ProjectService.applyChangesInOpenFiles (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:188508:56)
    at updateOpen (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:189701:29)
    at c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:192369:15
    at IpcIOSession.executeWithRequestId (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:192358:14)
    at IpcIOSession.executeCommand (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:192367:29)
    at IpcIOSession.onMessage (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\typescript.js:192415:68)
    at process.<anonymous> (c:\Users\ryanca\.vscode\extensions\ms-vscode.vscode-typescript-next-5.6.20240808\node_modules\typescript\lib\tsserver.js:525:14)
    at process.emit (node:events:519:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Info 27   [09:33:13.313] Couldn't find missing
adrien-febvay commented 2 months ago

I think it should be obvious there is an issue with the configuration. I stumbled on a related issue yesterday and it took me a while to notice that there was an issue with a plugin.

I would expect the same kind of output as for an invalid option:

tsconfig.json:6:5 - error TS5023: Unknown compiler option 'bad-option'.

6     "bad-option": "some-value",
      ~~~~~~~~~~~~

Found 1 error in tsconfig.json:6

Something like:

tsconfig.json:4:7 - error TSxxxx: Plugin not found 'missing-plugin'.

4       "name": "missing-plugin",
      ~~~~~~~~~~~~

Found 1 error in tsconfig.json:4

Otherwise we could get a bad compilation without knowing about it and it really seems like a flaw.

Now I have to find the TS Server log. I didn't even know it existed.