Open TechAkayy opened 5 months ago
This is a known limitation with how Angular compilation works with Vite. The analog plugin needs to be first in the chain
Thanks for the clarification 👍🏽 I believe it will be very helpful if this was added to the documentation in some form. The reason is there are numerous vite plugins that does various processing before passing it to SFC plugins. The transform hook is also used extensively to make changes to code in custom user-land plugins as workarounds a lot. Thanks.
Good point and should need some clarification in the docs
Please provide the environment you discovered this bug in.
https://github.com/TechAkayy/my-analog-app-transform-hook-issue/blob/main/vite.config.ts#L9-L21
Which area/package is the issue in?
vite-plugin-angular
Description
@analogjs/vite-plugin-angular
Analog's vite plugin is not using the transformed code from the previous vite plugin. The
transform
hook must perform transformation on top of what was done by the previous plugin's (in the plugin chain)transform
hook.Please refer to the above github reproduction (stackblitz doesn't seem to work with .analog files), in which
transform
hook to change the picture to that of a Puppy.I could be wrong here, but I notice that analog's vite plugin reads the file from the file system for it's code here, instead of using the code that came with the transform hook.
Here is an example of how Vue's & React's vite plugin's transform hook.
Please provide the exception or error you saw
Other information
I would be willing to submit a PR to fix this issue