No Code Attached Yet
avatar Elfangor93
Elfangor93
20 Jan 2025

Steps to reproduce the issue

Place this code anywhere in a custom extension to load an external JS dependency:

$wa = Factory::getDocument()->getWebAssetManager();
$wa->registerAndUseScript('sesame.stripepay', 'https://js.stripe.com/v3/');

Expected result

Should add <script src="https://js.stripe.com/v3/" data-asset-name="sesame.stripepay"></script> to the HTML <head>.

Actual result

But adds <script src="/joomla/root/path/https://js.stripe.com/v3/" data-asset-name="sesame.stripepay"></script> to the HTML <head>.

This results in a 404 when fetching the JS external asset which leads to JS errors if the asset is used and called afterwards.

System information (as much as possible)

  • PHP v8.1.2
  • Joomla v5.3.0-alpha2

Additional comments

The issue is created here:

// Asset for the ES modules may give us a folder for ESM import map
if (str_ends_with($path, '/') && !str_starts_with($path, '.')) {
$path = Uri::root(true) . '/' . $path;
}

Looks like a bug, related to support of ESM import map

avatar Elfangor93 Elfangor93 - open - 20 Jan 2025
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jan 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Jan 2025
avatar joomdonation joomdonation - change - 20 Jan 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-01-20 15:45:45
Closed_By joomdonation
avatar joomdonation joomdonation - close - 20 Jan 2025
avatar joomdonation
joomdonation - comment - 20 Jan 2025

Close because it is duplicate with the one I opened earlier

Add a Comment

Login with GitHub to post a comment