LiveView stop working because of one import in app.js

I have imported a javascript library to app.js and creating an instance from this library, however that stop LiveView from working, and a live route behaves like a regular http route

import {SomeObject} from "MyLibrary"
const someObject = new SomeObject()

Iam really wondered what can cause this strange behaviour, there is no errors or warnings at all, and once I put those 2 lines in a comment, everything returns to work normally including LiveView, also I confirmed that the library and the constructor works normally for another frameworks so where is the problem please ?

We’re going to need a bit more information than that to help you.
Can you show the full app.js file? What is the library? Are there any console errors in the browser?
Do you get past the constructor in your js file?

1 Like

hi @tcoopman,
the app.js file as I said is the default one with addtion of just the two lines above, and there was no errors neither warnings

can you maybe push a reproduction of the issue in that case?

1 Like

Yes it is my pleasure, what should I push exactly please ?

Can you push the repository that has the issue to github for example?

You should show this js file…

You should be more explicit… do You have error logs?

Are You manipulating DOM in your library?

Why You choose to put the code in apps.js instead of a hook? Maybe it is live_view updating the DOM

1 Like

Thank you @kokolegorille,
I mentionned above that I didn’t have any errors or warnings logs, I have added just the two lines above to app.js, I didn’t use hooks before and I don’t have an idea about them and if they are suitable for my case which simply import and use js library, all what I know about hooks is we can use them to render external components like React’s ones, so if you can share some useful informations or tutorials about it I will be very thankful.
The library is to connect a digital wallet to phoenix app, GitHub - perawallet/connect: JavaScript SDK for integrating Pera Wallet to web applications.

But I don’t think that this repo has any issues because it works out of the box