Method code too large - Issue

We are migrating our site to Lucee 4.5 from coldfusion. We are getting
error method code too large.

There is too much code inside the template [****], Lucee was not able to
break it into pieces, move parts of your code to an include or a external
component/function.

But the same is working on coldfusion. Is there any solution/suggestion to
fix the same?

Abishek:
You will need to break the code into several smaller templates or components. So, a little refactoring is needed.

This limit existed in Lucee/Railo for a while not sure whether it has changed in Lucee 5.