That's a good catch if it works! I thought about doing that and assumed some intermediate files might get created and wouldn't work at runtime.
I had hoped when they announced Widgets calling AppIntents that this was something the compiler would have done for us. Why the AppIntent needs to compile in a target where the code will never run seems non-optimal.