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    
Size: Mime:
/**
 * @file @todo can separate the ui from the server, or need to mark as external?
 */
import { config } from 'src/bootstrap/config';
import { logger } from '../../log';
// uncomment for SSR
// @note - this is problematic, tightly coupled
if (process.env.DEV_SSR_LOAD_DIST) {
    // @todo - this we use for better server loading soon...
    // logger.debug('[ssr] !!! disabled requiring dist at dev time')
    // const { App, client } = require('./../../../dist/dist/bundled/server')
    // logger.info('[ssr] !!! loading client', Object.keys(client))
    // config
    //   .set('App', App)
    //   .set('client', client)
}
else if (process.env.DISABLE_SSR === 'true') {
    logger.warn('[ssr] !!! disabled requiring src at build time');
}
else {
    const { App, client } = require('src/index');
    logger.info('[ssr] !!! loading client', Object.keys(client));
    config
        .set('App', App)
        .set('client', client);
}
const scoped = Object.seal({
    client: undefined,
    App: undefined,
});
// default it to this for now
if (process.env.MOCK_CLIENT_DEPS_ON_SERVER || true) {
    scoped.App = () => 'no ssr';
    scoped.client = {
        extract() {
            return {
            // extracted
            };
        },
    };
}
/**
 * @see https://www.apollographql.com/docs/react/features/server-side-rendering.html#server-initialization
 */
export function requireClient() {
    if (process.env.REQUIRE_CLIENT_UNCACHED) {
        throw new Error('requiring uncached client unsupported. please do not use REQUIRE_CLIENT_UNCACHED');
    }
    else {
        logger.debug('[react-server] getting dependencies from @skava/di');
        if (config.has('client') === true) {
            scoped.client = config.get('client');
        }
        if (config.has('App') === true) {
            scoped.App = config.get('App');
        }
    }
    return scoped;
}
//# sourceMappingURL=requireClient.js.map