-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with Typescript 4.7 #452
Comments
The current version is released as |
I've created a minimal reproduction: https://github.com/dargmuesli/stompjs-demo The commands |
I tried your project. What I can figure out:
Digging deeper, the issue does not seem to be with Typescript compilation but with node's ability to execute the compiled output.
Further experimenting, when I instruct So, I will suggest focusing on running the generated code with Node - by using |
For reference the
|
Ok! Sadly I currently cannot use |
In such cases in the past, I used the library in the source code form - by using the original .ts files and compiling these along with my project code. For similar reasons, the Angular version of this library was distributed as source for quite a while. |
How would I give the instruction to import or compile typescript files from a dependency that would resolve to the built output by default? |
I have the same problem! |
This package is distributed as UMD and ESM. NodeJS does not honor the module key in package.json. Ref https://nodejs.org/api/packages.html#packages_exports and https://nodejs.org/api/packages.html#dual-commonjses-module-packages |
The latest |
I receive many errors like
So it appears that the module code is not compatible with nodenext yet. |
I think it needs more changes. I will fix it shortly. |
Tested with the recently released beta2. I needed to add WebSocket polyfill, and it worked for me (I checked out the project you had shared earlier). $ yarn add ws @types/ws @stomp/[email protected] The test file: import { Client } from '@stomp/stompjs';
import { WebSocket } from 'ws';
Object.assign(global, { WebSocket});
const client = new Client({
brokerURL: 'ws://localhost:15674/ws',
debug: console.log,
onConnect: () => {
client.subscribe('/topic/test01', message => console.log(`Received: ${message.body}`));
client.publish({destination: '/topic/test01', body: 'First Message'});
}
});
client.activate(); |
It indeed does work for me now! Thank you :) Let's close this issue once v7 is not beta anymore. What else do you plan for v7? |
All the items intended for 7.0 has been completed. Please see https://github.com/stomp-js/stompjs/blob/develop/Change-log.md The module system change caused tooling breakage, including the bundler and test setup. So, it might cause breakages for others as well. So, waiting for a few reports before pushing it to 7.0. |
Released 7.0,0 |
Trying to use Typescript 4.7 with the attached
tsconfig
yields the following error:What can I do about it?
The text was updated successfully, but these errors were encountered: