Closed transopticmedia closed 2 years ago
I'd try the same thing in local dev -- do a production build, and disable the dev server, to see if you can get it to reproduce locally not using the dev server.
Somehow, some way, the manifestPath
is ending up being empty. This is the line of code where it is erroring:
$contents = @file_get_contents($pathOrUrl);
https://github.com/nystudio107/craft-plugin-vite/blob/develop/src/helpers/FileHelper.php#L88
Thanks for taking a look! yeah, I tried that locally, and it's working fine, with and without the dev server. I'll keep poking round.
Yeah so if it's working fine locally both with a production build, and with the dev server... it's almost always going to be something environmental.
Make sure that your .env
is right on production, your aliases are properly set on production (ensure you are explicitly setting the @webroot
alias), make sure config/vite.php
is deployed on production, etc.
I can tell you that the error is that an entirely empty path is being passed into manifestPath
, which is causing the error. How, I don't know.
Oh jeez.. it was a permission mismatch on vite.php. You comment "Somehow, some way, the manifestPath is ending up being empty." made me check... thanks!!
That makes total sense. Always does, in retrospect! :)
@transopticmedia I'd love to know how you determined that you had a permission mismatch, and how you resolved it exactly? I've been struggling with this same issue "ValueError: Path cannot be empty" with the Vite plugin. I have yet to resolve it after months of dipping in and out of a new build.
Hi, I'm not having any luck getting craft-vite to work on my server. Locally in DDEV, it's working perfectly and the configuration is working – it will use HMR version when I set the env variable, and it will use the manifest to load built css and JS when I set it to.
On the server, it keep getting the error: ValueError: Path cannot be empty.
I suspected that it's not finding the manifest.json file, but I've even tried hard coding it and it doesn't fixe the error. I've checked the permissions on the manifest.json, and it's fine. I'm stumped -- have you see this error?
Sorry for the data dump, here's my config and stack trace. I truly appreciate any assistance or tips you can provide.
vite.php
vite.config.js:
Stack Trace:
.env