Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/bs / dist / scripts / bundle / fromBuildOptionsToPaths.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @todo @james @fixme @important public path SHOULD be absolute as a non fully qualified domain name
 * @example /client/ > http://0.0.0:444/client/
 *
 * @param {any} bundlingOptions
 * @returns
 */
function fromBuildOptionsToPaths(bundlingOptions) {
    const { isDev, isProd, isClient } = bundlingOptions;
    /**
     * @deprecated this commented out way
     * will be tree shaken when static - we want this as dynamic
     *
     * @constant
     * @static
     * @example
     * const { bundleConfig } = bundlingOptions
     * const { host, port, clientDevServerPort } = bundlingOptions
     *
     * -------------
     * @event refactored |>>
     */
    // /server/??? not a web path....
    const webPath = isClient || isProd ? process.env.WEB_PATH || '/client/' : '/server/';
    const named = isClient ? 'client' : 'server';
    // const DEV_ABSOLUTE_URL = process.env.PUBLIC_PATH_URL
    // const DEV_ABSOLUTE_URL = process.env.SERVER_URL + webPath
    // const DEV_HMR_URL = `webpack-hot-middleware/client?reload=true&path=${DEV_ABSOLUTE_URL}` + '__webpack_hmr'
    // const DEV_ABSOLUTE_URL = process.env.SERVER_URL + webPath
    const DEV_ABSOLUTE_URL = '/';
    // const DEV_HMR_URL = `webpack-hot-middleware/client?reload=true&path=/__webpack_hmr?name=${named}`
    // @todo add as env
    const DEV_HMR_URL = `webpack-hot-middleware/client?path=/__webpack_hmr?name=${named}`;
    // dev
    const outputPublicPath = DEV_ABSOLUTE_URL;
    let clientServerPublicPath = outputPublicPath;
    if (isProd) {
        clientServerPublicPath = webPath;
    }
    console.log({ outputPublicPath });
    bundlingOptions.DEV_HMR_URL = DEV_HMR_URL;
    bundlingOptions.outputPublicPath = outputPublicPath;
    bundlingOptions.clientServerPublicPath = clientServerPublicPath;
    bundlingOptions.webPath = webPath;
    return {
        DEV_HMR_URL,
        outputPublicPath,
        clientServerPublicPath,
        webPath,
    };
}
exports.fromBuildOptionsToPaths = fromBuildOptionsToPaths;
//# sourceMappingURL=fromBuildOptionsToPaths.js.map