-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows]: Possible entrypoint path mismatch between the manisfest.json and Illuminate/Foundation/Vite.php #19
Comments
Hey @VicGUTT, Thanks for reporting this and for your proposed solutions! I think the right approach would be to wrap the path in Vite's normalizePath helper: - import { Plugin, loadEnv, UserConfig, ConfigEnv, Manifest, ResolvedConfig, SSROptions } from 'vite'
+ import { Plugin, loadEnv, UserConfig, ConfigEnv, Manifest, ResolvedConfig, SSROptions, normalizePath } from 'vite'
...
- const relativeChunkPath = path.relative(resolvedConfig.root, chunk.facadeModuleId);
+ const relativeChunkPath = normalizePath(path.relative(resolvedConfig.root, chunk.facadeModuleId)); I'll give this a try this afternoon. |
@jessarcher, nice, thanks for the fix ! 👌 Small concern, while I'm totally fine with the status quo, the PHP side may still throw the exception if entrypoints are provided to the directive using Windows separators: @vite(['resources\css\app.css', 'resources\ts\app.ts']) Although I don't think anyone would do this, I believe the framework should still handle the rare cases the situation would arise as to not burden users about thinking about it. |
IMO I don't think we should cater for this. Similar to how mix doesn't support this syntax. When we are in blade etc, we are in web world and should always use forward slashes. |
I'm also encountering this error with app.css....
And my Vite config...
|
This problem has been addressed in later releases, and what is more with Vite 3, we are no longer responsible for generating the CSS paths. I recommend updating to the latest package and Vite release. You may need to adjust your version constraints to get to the latest versions. |
Looks like there is an issue in Vite itself. To keep up with this issue, watch this issue: #101 (comment) |
Just dropping by to say Thank you ! @jessarcher for the implementation here and @timacdonald for the upstream PR. Freaking love Open Source ! 💪🏾 ❤️ |
💖💖💖 |
composer create-project laravel/laravel:dev-vite
)Description:
An
Unable to locate file in Vite manifest: {$entrypoint}
exception may be thrown on Windows caused by a mismatch between the entrypoint path strings stored inmanisfest.json
and an entry point given to the@vite
Blade directive.Example
Consider the following bare bones Vite config file:
And the
@vite
blade directive usage:This may produce the aforementioned exception.
This is because entrypoint paths in the
manifest.json
file may follow Windows' backslash path separator:But as here the CSS path given to the directive (
'resources/css/app.css'
) uses the regular slash path separator this causes$manifest[$entrypoint]
to fail in line 53 of/laravel/framework/blob/vite/src/Illuminate/Foundation/Vite.php
.Note
This only seem to happen for CSS entry paths.
Possible solutions
From what I understand taking a quick look at the source code of each library, the problem could be solved in line 166 by doing something similar to:
And on the PHP side:
Or only on the PHP side:
Question:
Which approach would be better suited to be PRed ?
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: