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