From e20baf8c1d2973babab9eb3b5fb1bd931e977c21 Mon Sep 17 00:00:00 2001 From: jj Date: Thu, 19 Oct 2017 10:44:34 -0700 Subject: [PATCH 1/2] Add section about the crossOriginLoading setting in webpack --- content/docs/cross-origin-errors.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/content/docs/cross-origin-errors.md b/content/docs/cross-origin-errors.md index 5a0a073f..689bf0cf 100644 --- a/content/docs/cross-origin-errors.md +++ b/content/docs/cross-origin-errors.md @@ -28,6 +28,15 @@ Also ensure the CDN responds with the `Access-Control-Allow-Origin: *` HTTP head ### Webpack +#### Source maps + Some JavaScript bundlers may wrap the application code with `eval` statements in development. (For example Webpack will do this if [`devtool`](https://webpack.js.org/configuration/devtool/) is set to any value containing the word "eval".) This may cause errors to be treated as cross-origin. -If you use Webpack, we recommend using the `cheap-module-source-map` setting in development to avoid this problem. \ No newline at end of file +If you use Webpack, we recommend using the `cheap-module-source-map` setting in development to avoid this problem. + +#### Code splitting + +If your application is split into multiple bundles, these bundles may be loaded using JSONP. This may cause errors thrown in the code of these bundles to be treated as cross-origin. + +If you use Webpack, you can use the [`crossOriginLoading`](https://webpack.js.org/configuration/output/#output-crossoriginloading) setting in development to add the `crossorigin` attribute to the `