-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling both preload and integrity hashes causes double asset download #101
Comments
I'm facing the same issue. IMHO it's web-link, that must also set At least when doing so, the problem disappears. 😄 It feels these two bundles should not rely too heavily on each other. But they probably would need to a bit if this the right way to fix the issue. Maybe @weaverryan can shed some light on this, then I'll have a go with a PR? |
I did also stumble over this issue. I did currently workaround the following way: webpack_encore:
preload: false {% set assetCss = asset('build/website/app.css') %}
{% do preload(assetCss, { as: 'style', integrity: app_integrity('website', assetCss) }) %}
{{ encore_entry_link_tags('app', null, 'website') }} <?php
namespace App\Twig;
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollectionInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class IntegrityExtension extends AbstractExtension
{
/**
* @var EntrypointLookupCollectionInterface
*/
private $entrypointLookupCollection;
public function __construct(
EntrypointLookupCollectionInterface $entrypointLookupCollection
) {
$this->entrypointLookupCollection = $entrypointLookupCollection;
}
public function getFunctions(): array
{
return [
new TwigFunction(
'app_integrity',
[$this, 'getIntegrity'],
[
'is_safe' => ['html'],
]
),
];
}
public function getIntegrity(string $buildname, string $path): string
{
$integrityList = $this->entrypointLookupCollection->getEntrypointLookup($buildname)->getIntegrityData();
return $integrityList[$path];
}
} |
Faced same issue today. Initially wanted to do it manually |
According to this comment on Stackoverflow, both the Using Symfony 6.3.2 and Encore 1.17.1 both the parameters are present on the However only the crossorigin parameter is specified on the My current Encore config is: webpack_encore:
crossorigin: 'anonymous'
preload: true |
Having the same issue now with newer symfony/webpack-encore-bundle 2.1.1 and symfony 5.4. |
As you can see in the screenshots below, having both preload and integrity enabled causes issues like double asset download.
This seems to be caused by the tag renderer that does not sets the link header with the integrities.
The text was updated successfully, but these errors were encountered: