-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
improvement(server): Allow setting async/defer via extraProps #526
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.
async
should be true by default- The micro-optimization reduces the code lisibility (and probably does not change anything)
- The method
getRequiredChunksScriptTag
should support async and defer like others, the difference of options should be coded ingetScriptTags
andgetScriptElements
. - Documentation is missing
One question about this though, does |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@gregberge Hi, are we really deciding on this as |
Just want to express my desire for this functionality. Right now I'm resorting to hackily string replacing |
Would love this feature too |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Stalebot go away |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Would love this feature too!! |
1 similar comment
Would love this feature too!! |
Summary
Solving #337
Default:
async: true, defer: false
Scenarios:
extractor.getScriptTags({ defer: true })
will return<script async defer ...></script>
(becauseasync
istrue
by default)extractor.getScriptTags({ async: true })
will return<script async ...></script>
extractor.getScriptTags({ async: false, defer: true })
will return<script defer ...></script>
extractor.getScriptTags()
will return<script async ...></script>
to keep the default behaviour, preventing breaking change.Using both
async
anddefer
together might have a valid use case as explained hereTest plan
Tests are added to
ChunkExtractor.test.js