typo3-vite-demo
typo3-vite-demo copied to clipboard
Assets result in 404 with wrong path
Reproduce
Include a file, for example with url() in SCSS, that will be added to the assets of builds (could also be a problem of assets outside CSS). Both in development mode and productions builds assets have the wrong path resulting in 404.
Example from a background-image:
- Development:
GET https://typo3-vite-demo.ddev.site/packages/typo3_vite_demo/Resources/Private/Images/bg.svg 404 - Production:
GET https://typo3-vite-demo.ddev.site/assets/bg-17e50649.svg 404
Possible solutions
- use relative paths from source file
- complete extension path, e.g.
typo3conf/ext/typo3_vite_demo/Resources/Private/Images/bg.svg
One solution for production build is to apply the base to the Vite config:
base: '/typo3conf/ext/typo3_vite_demo/Resources/Public/Vite/'
For development, additional configuration appears to be necessary…
That is the solution for develop:
https://github.com/fgeierst/typo3-vite-demo/pull/22#issuecomment-1409939412