OFFLINE-GmbH / oc-vite-plugin

Vite integration for October CMS
MIT License
23 stars 9 forks source link

I have the next error in production mode #13

Closed ANZ48 closed 12 months ago

ANZ48 commented 12 months ago

This is when I upload the project to production

I have {% styles %} and {% scripts %} on my layouts

The imports: {{ vite([ { path: 'assets/css/input-tw.css' }, { path: 'assets/css/style.css' } ]) }} {{ vite([ { path: 'assets/js/app.js', defer: true } ]) }}

.env : INFO The application environment is [production].

ERROR

  1. ErrorException: Array to string conversion in /home/customer/www/domain/public_html/project/project/plugins/offline/vite/classes/Vite.php:171

  2. home/customer/www/domain/public_html/project/project/plugins/offline/vite/classes/Vite.php(124): OFFLINE\Vite\Classes\Vite->resolveAssetProd(Array)

  3. /home/customer/www/domain/public_html/project/project/plugins/offline/vite/classes/Vite.php(96): OFFLINE\Vite\Classes\Vite->resolveAsset(Array)

  4. /home/customer/www/domain/public_html/project/project/modules/system/classes/MarkupExtensionItem.php(166): OFFLINE\Vite\Classes\Vite::includeAssets(Array)

tobias-kuendig commented 12 months ago

The error handling is faulty here: https://github.com/OFFLINE-GmbH/oc-vite-plugin/blob/1b3d1caecb372a1d1a5c4647f836b76d5026462e/classes/Vite.php#L171

But the culprit of your problem is that the path you defined channot be found in your manifest.json. Check if the paths you mentioned are in there.

tobias-kuendig commented 12 months ago

v2.0.8 fixes the error handling.