forked from merative/spm-ui-addon-devenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
public-path.js
24 lines (18 loc) · 916 Bytes
/
public-path.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Path to SPMUIComponents directory (relative to WebContent folder).
const spmUIComponentsBaseURL = process.env.RELATIVE_PATH_TO_BUNDLE;
// Retrieves Static Content Server from SPM.
//
// The serverRootURL is set on the root document window so if a js bundle
// is requested by a UIM iframe the parent window is checked instead.
const serverRootURL =
window.curam || window.parent.curam
? window.curam.serverRootURL || window.parent.curam.serverRootURL || ''
: '';
// If a Static Content Server URL is not set, '../' must be prepended to
// the URL to get the correct relative path.
const spmUIComponentsRootURL = serverRootURL
? spmUIComponentsBaseURL
: `../${spmUIComponentsBaseURL}`;
// Concatenate the correct public path for use in webpack bundles.
const publicPath = `${serverRootURL}${spmUIComponentsRootURL}`;
export default __webpack_public_path__ = publicPath; // eslint-disable-line