From 94641f737c7003b4f94db005e1c127145372b488 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 23 Jun 2021 09:10:27 +0100 Subject: [PATCH] Merge pull request #4243 from overleaf/as-fix-webpack-public-path Configure webpack public path for gallery search bundle, fixing translations failing to load GitOrigin-RevId: e785ccac2bbba7ff9d929730c6ea84249f6db109 --- services/web/frontend/js/base.js | 1 + services/web/frontend/js/libraries.js | 5 ----- services/web/frontend/js/utils/webpack-public-path.js | 6 ++++++ 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 services/web/frontend/js/utils/webpack-public-path.js diff --git a/services/web/frontend/js/base.js b/services/web/frontend/js/base.js index 60f0b38da3..1059b69a55 100644 --- a/services/web/frontend/js/base.js +++ b/services/web/frontend/js/base.js @@ -16,6 +16,7 @@ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ +import './utils/webpack-public-path' import './libraries' import './infrastructure/error-reporter' import './modules/recursionHelper' diff --git a/services/web/frontend/js/libraries.js b/services/web/frontend/js/libraries.js index 87ac1df89c..b33fa17904 100644 --- a/services/web/frontend/js/libraries.js +++ b/services/web/frontend/js/libraries.js @@ -18,8 +18,3 @@ import 'isomorphic-unfetch' // Rewrite meta elements import './utils/meta' - -// Configure dynamically loaded assets (via webpack) to be downloaded from CDN -// See: https://webpack.js.org/guides/public-path/#on-the-fly -// eslint-disable-next-line no-undef, camelcase -__webpack_public_path__ = window.baseAssetPath diff --git a/services/web/frontend/js/utils/webpack-public-path.js b/services/web/frontend/js/utils/webpack-public-path.js new file mode 100644 index 0000000000..4675dfd3f8 --- /dev/null +++ b/services/web/frontend/js/utils/webpack-public-path.js @@ -0,0 +1,6 @@ +import getMeta from './meta' + +// Configure dynamically loaded assets (via webpack) to be downloaded from CDN +// See: https://webpack.js.org/guides/public-path/#on-the-fly +// eslint-disable-next-line no-undef, camelcase +__webpack_public_path__ = getMeta('ol-baseAssetPath')