Hi, Kentico Dev!
Yes, you are right, unfortunately this is a known issue and Kentico always references all scripts required for MVC form builder, even if there is no form on the page. This method in your view is including this bundle @Html.Kentico().PageBuilderScripts()
. There are a couple of workarounds that can reduce the impact though, but will not solve the problem completely.
-
Delete large JS files if you don't use these form controls
- If you don't use File Uploader form control - delete \Kentico\Content\FormComponents\FileUploader\file-uploader.js file
- If you don't use US Phone control - delete \Kentico\Content\FormComponents\USPhone\inputmask.js (it's quite big as well)
- Once you've done this, there should be only \Kentico\Scripts\forms\updatableFormHelper.js that is left in the bundle, but this script is necessary for form builder for to submit.
-
Explicitly reference only small script required for form submit (File Uploader and US Phone form controls won't work then)
- In preview mode add @Html.Kentico().PageBuilderScripts()
- On frontend (non-preview) render \Kentico\Scripts\forms\updatableFormHelper.js
Hope it helps.