UNPKG

infrastructure-components

Version:

Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.

27 lines 1.57 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_dom_1 = __importDefault(require("react-dom")); const loader_1 = require("../libs/loader"); const routed_app_1 = require("./routed-app"); const types_1 = __importDefault(require("../types")); const datalayer_integration_1 = require("./datalayer-integration"); /** * this module must not import anything that does not exist in web-mode, e.g. fs */ const createApp = () => { // load the IsomorphicComponent // we must load it directly from the module here, to enable the aliad of the config_file_path const soaConfig = loader_1.loadConfigurationFromModule(require('__CONFIG_FILE_PATH__'), loader_1.INFRASTRUCTURE_MODES.RUNTIME); // function to create the client-side app with const fCreateApp = soaConfig.dataLayerId !== undefined ? (node) => datalayer_integration_1.renderFromDataLayer(node, loader_1.extractObject(soaConfig, types_1.default.INFRASTRUCTURE_TYPE_COMPONENT, soaConfig.dataLayerId)) : (node) => { console.log("no data layer present"); return node; }; react_dom_1.default.render(fCreateApp(routed_app_1.createSinglePageApp(soaConfig.routes, soaConfig.redirects)), document.getElementById('root')); }; // this module MUST NOT export anything else. Because it would also load the default, which would be executed right away exports.default = createApp(); //# sourceMappingURL=soa.js.map