typo3_encore
typo3_encore copied to clipboard
SvgViewhelper assumes that the SvgSpriteMap is always available locally as a file.
We use the webpack-dev-server from Webpack and this provides our SvgSpriteMap as URL. The AssetViewhelper can handle such URL's but the Viewhelper for SVG's can't yet but should be extended.
What we noticed: The AssetViewhelper seems to use a PackageFactory.
$this->packageFactory->getPackage($this->arguments['package'])->getUrl($this->filesystem->getRelativeFilePath($this->arguments['pathToFile']));
The SvgViewhelper always seems to look for a local file.
$image = $this->imageService->getImage($this->arguments['src'], null, false);
Would you like to investigate more and fix this issue? Would be awesome, because i have no real setup to reproduce and fix this issue. Thank you.
@nm-dh Do you have any idea how to fix this issue. Would be really cool to have a complete setup here.
Unfortunately, I have not yet been able to follow up the error.
@nm-dh Could you please check if the master is working for you? I have added a simple fallback mechanism for the SvgViewHelper
@sabbelasichon
I checked it and it does not work for me.
I posted a fast solution in this comment. https://github.com/sabbelasichon/typo3_encore/issues/174#issuecomment-1416228158
But even after fixing with my proposal there is still problem. In browser console there is an error:
Unsafe attempt to load URL https://t3base11.ddev.site:8080/assets/frontend/build/sprite.410880c0095f36da6e63c4ea5ec898ae.svg from frame with URL https://t3base11.ddev.site/. Domains, protocols and ports must match.
A solution is to make svg inline.