Align all tsconfigs and vscode-ws-jsonrpc provides esm/cjs - #390
Conversation
- Added typesVersions to monaco-languageclient and vscode-ws-jsonrpc, so exports can be properly imported with TS
| ## BREAKING CHANGES | ||
|
|
||
| * If you use Webpack or vite for bundling, you have to remove the `vscode` alias entry from the configuration | ||
| * If you customized monaco services, then you have to add them |
There was a problem hiding this comment.
What do you mean by then you have to add them? The interfaces just changed
There was a problem hiding this comment.
"adjust them" or "adjust them to the changed interfaces" instead of "add them". Don't know why I wrote this!? 😊
Do we have an example for that inside this repo?
There was a problem hiding this comment.
I don't think so... I think the most important points is the Workspace taking the uri and workspaceFolders instead of a path, and the monaco namespace not required to be provided
I admit I didn't experience any issue with |
| import * as net from 'net'; | ||
| import express from 'express'; | ||
| import * as rpc from 'vscode-ws-jsonrpc'; | ||
| import * as rpc from 'vscode-ws-jsonrpc/cjs'; |
There was a problem hiding this comment.
@CGNonofr this did not work before I added the typedVersions. tsc/vscode complain it is not defined
There was a problem hiding this comment.
Why do we need to use the cjs version here?
There was a problem hiding this comment.
I had the same thought. This is a node application and when I switched to modules/esm then I ran into import errors beyond vscode-ws-jsonrpc. Before everything was commonjs and it worked. I ensure it works the same way now, too. Here no bundler is involved (vite or webpack could handle this problem)
I need to look into module only node/ts, but I just wanted to make it work again for now and provide people with options.
There was a problem hiding this comment.
btw, I use node --loader ts-node/esm instead of node -r ts-node/register in my projects, maybe it helps?
There was a problem hiding this comment.
I can give it a try
|
Shall I remove the AMD and CJS build from |
Yep! I wonder why anything else than ESM would be useful in 2022. And then I noticed vscode-languageclient is still in CJS only 😞 |
|
@CGNonofr I update the CHANGELOGs (sorry for the dash changes). Do you think the BREAKING CHANGE section is now better (in both packages)? |
c1cda5e to
31bd60b
Compare
Looks good 👍 |
|
Ready for merge then? |
Added
typesVersionsto monaco-languageclient and vscode-ws-jsonrpc, so exports can be properly imported with TS:I did not understand why the "exports" lead to import problems in typescript (node example) until I found this:
https://github.com/teppeis/typescript-subpath-exports-workaround
vscode-ws-jsonrpcgets a 1.0.1 release once this is merged.and it makes sense to release a 2.0.2 of
monaco-languageclient, because of thetypesVersions. Do you have other things that should be fixed as well?