-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[AssetMapper] Asset Mapper fail after deleting "assets" folder #53669
Comments
This also effects 6.4 as well. Currently you can use a simple workaround, just leave or create an empty assets directory. |
assets folders + assets/controllers are needed at least (put a .empty do the trick) |
It looks like this error is thrown from I've verified the following check fixes this, I'm unsure if it's the solution that the core Symfony team would want though, or if they'd want a more thorough check (like if this condition is true and if ($_ENV['APP_ENV'] !== 'dev' && $path === 'assets/') {
continue;
} |
I closed your PR a bit too quickly @rynhndrcksn, sorry about that. This cannot be the correct approach to me. |
No problem @nicolas-grekas ! I didn't know that hard coded values weren't okay, my apologies. I'll be happy to make the necessary changes once we get feedback from Ryan and make a new PR if that's okay! |
Indeed, you should be able to delete A) Add a new argument to Cheers! |
Ah okay, that makes a lot of sense, thank you Ryan! I'll get these modifications made and pushed later today! |
… in production (rynhndrcksn) This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] Fix exception if assets directory is missing in production | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53669 | License | MIT During deployment some people will compile their assets with Asset Mapper then delete the root `assets/` directory. This causes Asset Mapper to throw an exception, and a common work around people mentioned in the issue is to create an empty `assets/` directory. This PR makes it so the exception is only thrown while `kernel.debug` is equal to true, letting developers know locally that there's an issue, but allowing people to safely do this in their `production` environments. Commits ------- 962a044 Fix exception if assets dir is missing in prod
Symfony version(s) affected
7.*
Description
After compiling assets, if we delete the original assets folder (I don't want it on prod), symfony crash with :
An exception has been thrown during the rendering of a template ("The asset mapper directory "assets/" does not exist.").
{% block importmap %}{{ importmap('app') }}{% endblock %}
How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: