-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
matrix-js-sdk no longer works in node #4287
Comments
Apparently, the typescript way to do this is actually to import {foo} from "./matrix.js"`; // note js extension The |
I got the same error as you had |
If anybody would like to go through all the |
Fixes: matrix-org#4287 Signed-off-by: Johannes Marbach <[email protected]>
Bit of a wild idea but maybe we could just tweak the imports with babel? I haven't tested this a lot but #4373 at least lets me run the Node.js example locally. |
Fixes: matrix-org#4287 Signed-off-by: Johannes Marbach <[email protected]>
Alternatively, #4375 script-replaces all imports. This also lets me run the Node.js example but appears to break most test. |
SIGH. How can this possibly be so difficult? I can't believe we are the first library ever to use typescript and jest, and transpile to ES modules. Maybe what we want is to have the source say |
Fixes: matrix-org#4287 Signed-off-by: Johannes Marbach <[email protected]>
This looks promising: #4377 |
omg. How do I use this library then??? |
You might be able to tweak imports by using a bundler in your project until #4377 lands and is released. |
* Change imports for Node.js compatibility Fixes: #4287 Signed-off-by: Johannes Marbach <[email protected]> * Run prettier * Run prettier (again) * Add comment * Update babel.config.cjs --------- Signed-off-by: Johannes Marbach <[email protected]> Co-authored-by: Richard van der Hoff <[email protected]>
This should be fixed in v34.5. |
#4284 describes a problem wherein matrix-js-sdk no longer works in a CommonJS environment, but actually it's worse than that: it doesn't work in an ES modules environment either.
If we apply the fix from #4285, and run in an esm environment, I get:
The problem appears to be that
index.js
contains:However, the file it actually wants is
./matrix.js
, and the nodejs ESM resolver doesn't know it needs to add the extension. Likewise for every link in the project :/The text was updated successfully, but these errors were encountered: