Yup, I'm trying to transition to web development strongly because of the much higher compensation and the ability to work remotely.
I admit developing nonlinear curve fitting frameworks, working with laser physics and doing biomedical algorithms engineering was much more fun and fulfilling. However, it's far more appealing to enjoy more time with my family, work from a peaceful location and never have to deal with traffic.
Though this transition to web development isn't at all helped by the fact that Javascript feels like it was a failed experiment in hell where it was probably deemed to be far too tortuous to be used as punishment; only god knows how Mr. Eich got his hands on it.
(I've professionally written code in Java, Python, Matlab, Fortran, C, Go and assembly and none of those languages come within two orders of magnitude of the disdain I have for Javascript)
First of all, stop using plain JS and move to Typescript. That'll fix most of your issues with the language itself.
Second, for what's fulfilling, it depends on what you're actually working on. If you're going to just make dynamic menus for a wordpress blog then yeah, your life is gonna be boring. But nowadays "frontend" can mean writing entire apps. My latest site (https://overframe.gg/) is a SPA in React+Typescript and I had a lot of fun writing it. The nitty-gritty of reverse engineering games, simulating calculations, etc; all these are still there.
I miss working on campus at CIT (Cranfield Uni) unfortunately the pay was abysmal - some realy cool work tough.
Take my post as advice on how to enjoy something that may not be your passion.
Half of my career has been spent on such things and ironically this was the better paid one.
Apparently doing interesting stuff comes with a pretty hard penalty in terms of compensation.