1"use strict";
2/**
3 * Copyright © 2022 650 Industries.
4 *
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8Object.defineProperty(exports, "__esModule", { value: true });
9exports.buildUrlForBundle = void 0;
10function buildUrlForBundle(bundlePath) {
11    if (process.env.NODE_ENV === 'production') {
12        if (typeof location !== 'undefined') {
13            return joinComponents(location.origin, bundlePath);
14        }
15        throw new Error('Unable to determine the production URL where additional JavaScript chunks are hosted because the global "location" variable is not defined.');
16    }
17    else {
18        const getDevServer = require('../getDevServer')
19            .default;
20        const { url: serverUrl } = getDevServer();
21        return joinComponents(serverUrl, bundlePath);
22    }
23}
24exports.buildUrlForBundle = buildUrlForBundle;
25function joinComponents(prefix, suffix) {
26    return prefix.replace(/\/+$/, '') + '/' + suffix.replace(/^\/+/, '');
27}
28//# sourceMappingURL=buildUrlForBundle.native.js.map