From 3137b886b84e2c3670b305a8194a3532afe541be Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 28 Jun 2017 21:57:35 -0500 Subject: configure webpack publicPath dynamically to account for CDN or relative path settings --- app/assets/javascripts/webpack.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'app/assets/javascripts/webpack.js') diff --git a/app/assets/javascripts/webpack.js b/app/assets/javascripts/webpack.js index 37420dcafa0..9a9cf395fb8 100644 --- a/app/assets/javascripts/webpack.js +++ b/app/assets/javascripts/webpack.js @@ -1,13 +1,9 @@ /** * This is the first script loaded by webpack's runtime. It is used to manually configure - * config.output.publicPath to account for relative_url_root settings which cannot be baked-in - * to our webpack bundles. + * config.output.publicPath to account for relative_url_root or CDN settings which cannot be + * baked-in to our webpack bundles. */ -if (gon && gon.relative_url_root) { - // this assumes config.output.publicPath is an absolute path - const basePath = gon.relative_url_root.replace(/\/$/, ''); - - // eslint-disable-next-line camelcase, no-undef - __webpack_public_path__ = basePath + __webpack_public_path__; +if (gon && gon.webpack_public_path) { + __webpack_public_path__ = gon.webpack_public_path; // eslint-disable-line } -- cgit v1.2.3