typo3-vite-demo icon indicating copy to clipboard operation
typo3-vite-demo copied to clipboard

Assets result in 404 with wrong path

Open peter-neumann-dev opened this issue 2 years ago • 2 comments

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

peter-neumann-dev avatar Jan 31 '23 08:01 peter-neumann-dev

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…

peter-neumann-dev avatar Jan 31 '23 08:01 peter-neumann-dev

That is the solution for develop:

https://github.com/fgeierst/typo3-vite-demo/pull/22#issuecomment-1409939412

misterboe avatar Feb 01 '23 19:02 misterboe