Possibility to load chunks with crossorigin #988
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are facing the problem, that our tracking of javascript errors currently is not working, due to CORS restrictions. This is because we load our chunks from a cdn domain and not the pages current domain.
This can easily be fixed by adding the crossorigin attribute to the script tags, but we can't do that for the tags which are injected by webpack.
https://developer.mozilla.org/de/docs/Web/HTML/Element/script#attr-crossorigin
In this PR we added a new configuration option which can be set to one of the two valid options for the crossorigin attribute ('anonymous' or 'use-credentials')(by default false). If present the crossorigin attribute will be added to the injected script tag.
There are still some questions for this PR, which we are not sure about.
Sorry for all this questions, but we are not that fit with webpacks internals :)