fgeierst / typo3-vite-demo

GNU General Public License v2.0
20 stars 5 forks source link

Drop need of custom UserFunction and remove hashes by Vite #22

Closed peter-neumann-dev closed 1 year ago

misterboe commented 1 year ago

Removing hashes from the file names also means that all other assets like fonts, icon fonts and other included files will no longer have hashes. This caused problems with the cache times suggested by Google Pagespeed for visitors. The chunks files also no longer have hashes and will have to be loaded from the cache. I think the hashes bring many benefits and should not be removed. The timestamps in TYPO3 only solve the problem to a limited extent.

peter-neumann-dev commented 1 year ago

I didn't to think of other assets, you are right. Maybe it's still an option to only prevent hashing on the entry files. I will try this out soon.

peter-neumann-dev commented 1 year ago

It is possible to only prevent hashes of entry file main.js but CSS is treated as asset already that still needs to be added by parsing the JSON, so I will close this pull request and issue #23

Another problem occurred with assets like icons, images and fonts, because of Files being present in an Extension directory and not directly inside the public folder: #24

misterboe commented 1 year ago

The problem with the ext dircetory can be fixed by adding this to the vite config:

base: '/typo3conf/ext/site_package/Resources/Public/',
misterboe commented 1 year ago

If you want to try that you must change the dev urls like this:

<script type="module" src="http://localhost:5999/typo3conf/ext/site_package/Resources/Public/@vite/client"></script>
<script type="module" src="http://localhost:5999/typo3conf/ext/site_package/Resources/Public/Modules/GlobalTemplates/main.js"></script>

Default port is changed!!