Hi. I attempt to move project from ACF to Lucee 6 ...
# lucee
r
Hi. I attempt to move project from ACF to Lucee 6 (6.0.0.503-RC) and get error: "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 an external component/function Method code too large!." Is there any way to increase limit of template size?
z
6 isn't released yet.
lucee tries to break up cfcs into smaller chunks, you'll need to refactor
r
@zackster btw, maybe you know approximate dates when lucee6 will be release. Should I try to test moving to 6th or to 5th version? I plan to finish and deploy it to production in September-October
j
Are there lots of files with this issue, or just a few?
@zackster, mix-ins don't count toward the size limit, right? Can't you grab, say, 50% of the functions out of
MyComponent.cfc
, drop them in
_myComponent_mixin.cfm
and
include '_myComponent_mixin.cfm';
from
MyComponent.cfc
? In other words, temporary hackfactoring instead of a more convoluted refactor.
r
That's not cfc, that is large .cfm with html+cfm pages. I already divided some of them to several templates (Main.cfm includes Main0.cfm, Main1.cfm) and it works... But looks even worse than large cfm before 🙂
I wanted to move from ACF to Lucee with minimum code changes. Maybe I should try Lucee5, is there the same code size limits?
j
I don't know, myself about the size limit in 5.4. I also don't know whether it's premature to start targeting 6 for your migration, but I suspect it may be. Deferring to @zackster.
z
if you are new to lucee, stick with stable, 6 is not yet stable and maybe quirky, for a mmigration it makes little diff, if it works on 5.4 it will then work on 6
👍 1
b
@romanstr To answer your question, the max size of a class is enforced by the JVM and I'm not aware of a way to change that
Lucee does try to break up your code into different chunks but it may not always work
a
Main.cfm includes Main0.cfm, Main1.cfm
I hope that is just an example, and not how you decided to undertake this refactoring opportunity 😕
That's not cfc
This is your opportunity to put some of it (I suspect a lot of it) into appropriate CFC files. Don't bodge the job and make your code worse. Do it properly and make your code better.
👍 1
💯 2
z
@romanstr out of interest, how big are the problem file(s) ?
r
@zackster I've faced this problem in 3 templates: 120kb, 187kb, 240kb
d
If you have a lot of clear text/HTML in those CFML templates, I'd recommend moving those out into plain text files and then you can just include them. You can keep them out of the webroot so they are not accessible from the web server as well. That's the basic approach we use when there are large chunks of "static" information.
r
That's not clear html. That spaghetti of cfml, html, js, css styles in tag attributes... That's large legacy code that we always were afraid to rewrite because a lot of logic and conditions 😞 Now we're move some parts to React front-end and some of these template are good candidate to it. Or just divide big page to smaller modules and separate view/data.
z
that's the problem lucee is having trying to split up the spaghetti
make a copy and start progressively removing crap until it compiles in lucee and report back
👍 1
d
I would start with the JS and CSS and see if you can't refactor that to move it to external files. That might save a lot.