All files / app/common/bundler configurePublicPath.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 222x   2x     12x 1x   1x       1x   1x     11x   11x    
import getCurrentScriptPath from './getCurrentScriptPath';
 
export default function configurePublicPath(
    publicPath?: string
): string {
    if (!publicPath) {
        const scriptPath = getCurrentScriptPath();
 
        Iif (!scriptPath) {
            throw new Error('Unable to configure the public path of the application because it is not specified and it cannot be inferred using the path of the current script.');
        }
 
        __webpack_public_path__ = `${scriptPath.split('/').slice(0, -1).join('/')}/`;
 
        return __webpack_public_path__;
    }
 
    __webpack_public_path__ = publicPath.substr(-1) === '/' ? publicPath : `${publicPath}/`;
 
    return __webpack_public_path__;
}