Closed toddheslin closed 3 months ago
Would you be so kind and test the updated version?
Thanks @idleberg I'll do this early next week. :-)
@idleberg looks like it's still throwing an error where the imports
key is not present.
PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /var/www/html/plugins/pointhacks-plastic/vendor/idleberg/vite-manifest/src/ViteManifest.php:104
Stack trace:
#0 /var/www/html/plugins/pointhacks-plastic/vendor/idleberg/vite-manifest/src/ViteManifest.php(104): array_map(Object(Closure), NULL, Array)
#1 /var/www/html/plugins/pointhacks-plastic/vendor/idleberg/wordpress-vite-assets/src/WordpressViteAssets.php(139): Idleberg\ViteManifest\ViteManifest->getImports('assets/src/main...')
Not sure why that happens, the test went through fine. Anyway, made another modification.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
Description
Sometimes the
manifest.json
file doesn't have anincludes
property, and this throws an error.This is the line where we are directly accessing includes, which should fail gracefully but instead throws: https://github.com/idleberg/php-vite-manifest/blob/c9393a05a13135b48e41b4d6534ba390da1dc416/src/ViteManifest.php#L104
Here is my config:
vite.config.ts
manifest.json
To fix the problem, I've created this little plugin within the
vite.config.ts
, but ideally the package would deal with a lack of imports:vite.config.ts