12 - dynamic imports of custom components #442

Merged
bones7242 merged 3 commits from 12-conditional-compiltion into master 2018-05-15 18:07:39 +02:00
6 changed files with 4 additions and 57 deletions

View file

@ -1,17 +0,0 @@
function ViewsConfig () {
this.components = {};
this.containers = {};
this.pages = {};
this.update = (config) => {
if (!config) {
return console.log('No components config received.');
}
const { components, containers, pages } = config;
console.log('Configuring custom components ...');
this.components = components;
this.containers = containers;
this.pages = pages;
};
}
module.exports = new ViewsConfig();

View file

@ -13,14 +13,12 @@ const loggerConfig = require('./config/loggerConfig.js');
const mysqlConfig = require('./config/mysqlConfig.js');
const siteConfig = require('./config/siteConfig.js');
const slackConfig = require('./config/slackConfig.js');
const viewsConfig = require('./config/viewsConfig.js');
function Server () {
this.configureLogger = loggerConfig.update;
this.configureMysql = mysqlConfig.update;
this.configureSite = siteConfig.update;
this.configureSlack = slackConfig.update;
this.configureViews = viewsConfig.update;
this.createApp = () => {
// create an Express application
const app = express();

View file

@ -18,22 +18,13 @@ var _reactHelmet = _interopRequireDefault(require("react-helmet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
^ note: to do this right, maybe
these should be passed in from the implementation (www.spee.ch) itself,
so that there are no conflicts between the SSR here and
the bundle sent to the server?
there might also be issues if this package uses a different version of spee.ch-components than www.spee.ch does?
*/
var siteConfig = require('../../../config/siteConfig.js');
var viewsConfig = require('../../../config/viewsConfig.js');
module.exports = function (req, res) {
var context = {}; // customize the reducer by passing in intial state configs
var MyReducers = (0, _spee.Reducers)(siteConfig);
var MyApp = (0, _spee.App)(viewsConfig);
var MyApp = _spee.App;
var MyGAListener = (0, _spee.GAListener)(siteConfig); // create a new Redux store instance
var store = (0, _redux.createStore)(MyReducers); // render component to a string

View file

@ -22,17 +22,8 @@ var _reactHelmet = _interopRequireDefault(require("react-helmet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
^ note: to do this right, maybe
these should be passed in from the implementation (www.spee.ch) itself,
so that there are no conflicts between the SSR here and
the bundle sent to the server?
there might also be issues if this package uses a different version of spee.ch-components than www.spee.ch does?
*/
var siteConfig = require('../../../config/siteConfig.js');
var viewsConfig = require('../../../config/viewsConfig.js');
var returnSagaWithParams = function returnSagaWithParams(saga, params) {
return (
/*#__PURE__*/
@ -58,7 +49,7 @@ module.exports = function (req, res) {
var context = {}; // configure the reducers by passing initial state configs
var MyReducers = (0, _spee.Reducers)(siteConfig);
var MyApp = (0, _spee.App)(viewsConfig);
var MyApp = _spee.App;
var MyGAListener = (0, _spee.GAListener)(siteConfig); // create and apply middleware
var sagaMiddleware = (0, _reduxSaga.default)();

View file

@ -4,25 +4,17 @@ import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { StaticRouter } from 'react-router-dom';
import { Reducers, GAListener, App } from 'spee.ch-components';
/*
^ note: to do this right, maybe
these should be passed in from the implementation (www.spee.ch) itself,
so that there are no conflicts between the SSR here and
the bundle sent to the server?
there might also be issues if this package uses a different version of spee.ch-components than www.spee.ch does?
*/
import renderFullPage from '../renderFullPage.js';
import Helmet from 'react-helmet';
const siteConfig = require('../../../config/siteConfig.js');
const viewsConfig = require('../../../config/viewsConfig.js');
module.exports = (req, res) => {
let context = {};
// customize the reducer by passing in intial state configs
const MyReducers = Reducers(siteConfig);
const MyApp = App(viewsConfig);
const MyApp = App;
const MyGAListener = GAListener(siteConfig);
// create a new Redux store instance

View file

@ -7,17 +7,9 @@ import renderFullPage from '../renderFullPage';
import createSagaMiddleware from 'redux-saga';
import { call } from 'redux-saga/effects';
import { Reducers, GAListener, App, Sagas, Actions } from 'spee.ch-components';
/*
^ note: to do this right, maybe
these should be passed in from the implementation (www.spee.ch) itself,
so that there are no conflicts between the SSR here and
the bundle sent to the server?
there might also be issues if this package uses a different version of spee.ch-components than www.spee.ch does?
*/
import Helmet from 'react-helmet';
const siteConfig = require('../../../config/siteConfig.js');
const viewsConfig = require('../../../config/viewsConfig.js');
const returnSagaWithParams = (saga, params) => {
return function * () {
@ -30,7 +22,7 @@ module.exports = (req, res) => {
// configure the reducers by passing initial state configs
const MyReducers = Reducers(siteConfig);
const MyApp = App(viewsConfig);
const MyApp = App;
const MyGAListener = GAListener(siteConfig);
// create and apply middleware