Preserve async and defer attributes when using plugin-webpack #1603
jfranciscosousa
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
By the way, I can open a PR for this if it makes sense. Tried something locally and it works. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using
plugin-webpack
, any attribute that I set on thescript
tags gets erased after the build step. This question arose because I have an Eleventy website where I want to load all script tags withasync
/defer
attributes. I could place them on the body tag to load them asynchronously anyway but one of those scripts hasturbolinks
and that must be included in the head.I think it would be wise to preserve attributes on the original script tags. Looking at the code of the plugin I noticed it creates a new script tag with just a
src
attribute, perhaps we could copy the original script tag and just replace thesrc
.Any special reason why it works this way?
Beta Was this translation helpful? Give feedback.
All reactions