Skip to content

Instantly share code, notes, and snippets.

@wichopy
Created April 24, 2023 20:20
Show Gist options
  • Save wichopy/95fad00444be9d2de9d3acd95ffde0ed to your computer and use it in GitHub Desktop.
Save wichopy/95fad00444be9d2de9d3acd95ffde0ed to your computer and use it in GitHub Desktop.
Configure webpack in microfrontends to work with cors and error monitoring libraries
error monitoring needs your javascript bundles to allow CORS with the Access-Control-Allow-Origin header and to set the annonymous value on the crossorigin attribute in the script tag.
See rollbar docs:
https://rollbar.com/knowledge-base/unknownscript-error/
To configure this in webpack, simply update the output property:
https://webpack.js.org/configuration/output/#outputcrossoriginloading
output: {
// ...path and stuff,
crossOriginLoading: 'anonymous'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment