bzcomputers
Well-known member
Currently we have the options to minify scripts and roll up scripts in build.json. The issue comes when I want a rolled up script to also be minified. As far as I can tell the only option is to do something like this...
Which means the minification has to come before rolling up. This can cause issues.
The issue with this is the
I have come across issues where the concatenated minified scripts (minified individually and then rolled up, like what is produced by the build.json above) do not work. But if I manually rollup the scripts and then minify I do not have issues.
I think it would be nice if rollup could also have the ability to produce a minified result - of course being sure to process the rollup first before doing the minification.
JSON:
{
"additional_files": [
"js/bz/add-on1"
],
"minify": "*",
"rollup": {
"js/bz/add-on1/bz-addon1_combined.min.js": [
"js/bz/add-on1/bz-addon1_script1.min.js",
"js/bz/add-on1/bz-addon1_script2.min.js"
]
}
}
Which means the minification has to come before rolling up. This can cause issues.
The issue with this is the
bz-addon1_combined.min.js
script output from the code above is not guaranteed to function the same as if the original script files (bz-addon1_script1.js
& bz-addon1_script2.js
) were first rolled up and then minified together. Depending on the minification process used (which I don't think XenForo has even disclosed) the results can be quite different depending on which comes first minification or rollup. For the best chance in having fully functioning code in the end is that roll up must occur before any minification. It is important the minifier processes the entire codebase as a single unit, ensuring consistent variable renaming and optimization, preserving dependencies and execution order. I have come across issues where the concatenated minified scripts (minified individually and then rolled up, like what is produced by the build.json above) do not work. But if I manually rollup the scripts and then minify I do not have issues.
I think it would be nice if rollup could also have the ability to produce a minified result - of course being sure to process the rollup first before doing the minification.
Upvote
1