-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
[StimulusBundle] Check controllers source files for laziness #2304
[StimulusBundle] Check controllers source files for laziness #2304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MatTheCat, and thanks for the contribution.
I kind of agree with you, but I don't know how much of a breaking change it can be. :/
I guess it would break compilers wanting to interact with the StimulusBundle by adding or removing the |
It feels to me a very internal matter... and a very logical change.
To me it's never an AssetMapper thing, but a source code thing, so.. I'd even call this a feature to be honest , as it would remove the following constraint: Note If you write your controllers using TypeScript, make sure removeComments is not set to true in your TypeScript config. https://symfony.com/bundles/StimulusBundle/current/index.html#lazy-stimulus-controllers So i'm clearly 👍 on this @MatTheCat Do you think you could add a test or two ? |
8b5aff6
to
82d828d
Compare
Test added! |
82d828d
to
cd2e155
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @MatTheCat ! Nice fix/feat :)
Thanks! |
Thanks for fixing this bug Mathieu. |
…nger be necessary (MatTheCat) This PR was merged into the 2.x branch. Discussion ---------- [StimulusBundle][Doc] Mention `removeComments` will no longer be necessary | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | N/A | License | MIT Once #2304 is released, it will no longer be necessary to set `removeComments` to `false` when using TypeScript, because the `stimulusFetch: 'lazy'` comment will be searched in the source rather than the compiled content. Commits ------- a422be1 [StimulusBundle][Doc] Mention `removeComments` will no longer be necessary
The StimulusBundle allows to mark a controller as lazy using a
/* stimulusFetch: 'lazy' */
comment, but it will be searched in said controller’s compiled content. If the compilation removes that comment (it typically happens when using minifiers), then the controller is no longer considered lazy by theControllersMapGenerator
.This PR makes the comment searched in source files, so that its presence doesn’t depend on the compilation’s result.