If your frontend and your backend
then there is nothing generally wrong in having shared libraries for both, especially when there are things you want to keep in sync between frontend and backend. These libs can contain things as simple as error codes, but also more sophisticated artifacts like common datatypes, or validation logic you want to be executed for performance reasons in the frontend, but for security reasons also in the backend.
Be aware, however, whenever you reuse libs on both client and server, you will be exposing things from the server side to the public-facing client side. So you need to be careful what you are putting into such a common lib. This may be more a psychological than a technical issue, but to my experience, when backend code and frontend are strictly separated, the risk of exposing confidential internals is a lot lower.
Moreover, when your frontend is potentially deployed independently from your backend (like it often happens for mobile or desktop systems), then you have to take care that your software does not rely on both sides always using the same shared library version at all times. That situation isn't really different from the case where frontend and backend are developed mostly independently, by different teams and/or with different tools.