craft-webperf icon indicating copy to clipboard operation
craft-webperf copied to clipboard

Error rendering `_frontend/scripts/load-boomerang-iframe.twig` -> JSMin: Unterminated String at byte 201:

Open bart-honcho opened this issue 3 months ago • 6 comments

Describe the bug

When using webperf 5.0.0 with craft-minify 5.0.0, the boomerang iframe loader script throws a JSMin minification error: JSMin: Unterminated String at byte 201: ',

To reproduce

Steps to reproduce the behaviour:

  1. Install nystudio107/craft-webperf version 5.0.0
  2. Install nystudio107/craft-minify version 5.0.0
  3. Enable webperf beacon on a page
  4. Load the page in browser
  5. See error message: Error rendering '_frontend/scripts/load-boomerang-iframe.twig' -> JSMin: Unterminated String at byte 201: ',

Expected behaviour

A clear and concise description of what you expected to happen.

The boomerang iframe loader script should be rendered without minification errors, or the problematic JavaScript should be escaped in a way that's compatible with JSMin.

Versions

Plugin version: 5.0.0 Craft version: 5.8.19 craft-minify version: 5.0.0 mrclay/jsmin-php version: 2.4.3

bart-honcho avatar Dec 03 '25 16:12 bart-honcho

Sorry I did miss this one. I'll have a look at it today, I'm not sure if the issue lies with Minify, Webperf, or more likely a change in jsmin-php because the former two haven't changed in the interim.

khalwat avatar Dec 16 '25 19:12 khalwat

Same as: https://github.com/nystudio107/craft-webperf/issues/57

khalwat avatar Dec 16 '25 19:12 khalwat

The boomerang iframe loader script should be rendered without minification errors, or the problematic JavaScript should be escaped in a way that's compatible with JSMin.

Versions

Plugin version: 5.0.0 Craft version: 5.8.19 craft-minify version: 5.0.0 mrclay/jsmin-php version: 2.4.3

According to my newly generated composer.lock file, I have the following versions installed:

            "name": "craftcms/cms",
            "version": "5.8.21",
            "name": "nystudio107/craft-webperf",
            "version": "5.0.0",
            "name": "nystudio107/craft-minify",
            "version": "5.0.0",
            "name": "mrclay/jsmin-php",
            "version": "2.4.3",

...all of which match the versions you have installed. With these versions installed, I'm unable to reproduce the issue, either in local development (which minimizing doesn't happen) or in production (where I verified that the minification is happening).

Is there any chance that craft-webperf has been modified in some way? Have you tried re-installing it from scratch?

Can you check to see that your _frontend/scripts/load-boomerang-iframe.twig file matches exactly the file here? https://github.com/nystudio107/craft-webperf/blob/develop-v5/src/templates/_frontend/scripts/load-boomerang-iframe.twig

khalwat avatar Dec 17 '25 04:12 khalwat

Additional questions @bart-honcho @smcservices

  • Can you reproduce this issue in both local development in and production? For local development, ensure that devMode for Craft CMS is off so that it attempts to do the JS minification
  • If so, can you also reproduce this issue on any other websites/projects that are using Webperf?

khalwat avatar Dec 17 '25 20:12 khalwat

Hi there, @khalwat thank you for looking into this. Y es I could see the issue both locally and on production. The vendor files haven't been modified in any way I will re-install, test and get back to you - thanks!

bart-honcho avatar Dec 18 '25 15:12 bart-honcho

@bart-honcho okay thanks, let me know. If you do still experience it, please provide your PHP version as well.

khalwat avatar Dec 20 '25 22:12 khalwat

@bart-honcho any luck?

khalwat avatar Jan 27 '26 00:01 khalwat