Skip to content
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

Possibility to load chunks with crossorigin #988

Merged
merged 1 commit into from
Apr 20, 2015
Merged

Possibility to load chunks with crossorigin #988

merged 1 commit into from
Apr 20, 2015

Conversation

danez
Copy link
Contributor

@danez danez commented Apr 17, 2015

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.

  • the location of config option may be not placed correctly in the output options? Any better ideas where to put that option? Currently we have output.crossOriginLoading
  • Should we validate the value of the configuration and throw if an invalid value is used? Where to do that?
  • Can we test this feature? If so, can you point us to a place were this test would be best placed?

Sorry for all this questions, but we are not that fit with webpacks internals :)

Done by adding the crossorigin attribute to the injected script tag
sokra added a commit that referenced this pull request Apr 20, 2015
Possibility to load chunks with crossorigin
@sokra sokra merged commit 26512c5 into webpack:master Apr 20, 2015
@sokra
Copy link
Member

sokra commented Apr 20, 2015

Thanks

@sokra
Copy link
Member

sokra commented Apr 20, 2015

Can we test this feature? If so, can you point us to a place were this test would be best placed?

No idea how... We would need multiple domains...

@sokra
Copy link
Member

sokra commented Apr 20, 2015

Could you add the new option to the documentation?

@danez danez deleted the crossorigin-loading branch April 21, 2015 07:22
@danez
Copy link
Contributor Author

danez commented Apr 21, 2015

I added it.

@sokra
Copy link
Member

sokra commented Apr 21, 2015

Thanks

STRML added a commit to STRML/webpack that referenced this pull request Sep 27, 2017
Related: webpack#988

Useful especially for hot-reloaded React 16 apps so that the global
onerror handler can render error boundaries properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants