From 5b43aa955737f002be3d197c9f7b4d3374d0ad69 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 28 Jun 2017 15:15:50 -0500 Subject: move webpack publicPath setup earlier in the bootstrap processes to avoid ES module execution order issues --- app/assets/javascripts/webpack.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/assets/javascripts/webpack.js (limited to 'app/assets/javascripts/webpack.js') diff --git a/app/assets/javascripts/webpack.js b/app/assets/javascripts/webpack.js new file mode 100644 index 00000000000..37420dcafa0 --- /dev/null +++ b/app/assets/javascripts/webpack.js @@ -0,0 +1,13 @@ +/** + * 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. + */ + +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__; +} -- cgit v1.2.1