Skip to content

Instantly share code, notes, and snippets.

View BiosBoy's full-sized avatar
⛰️
The bigger you know - the less you scared of.

Sviat Kuzhelev BiosBoy

⛰️
The bigger you know - the less you scared of.
View GitHub Profile
// import global vars for a whole app
require('../globals');
const debug = require('debug')('app:build:webpack-compiler');
const webpack = require('webpack');
const webpackConfig = require('../webpack.config.js');
// -----------------------------
// READING WEBPACK CONFIGURATION
// -----------------------------
function webpackCompiler() {
return new Promise((resolve, reject) => {
const compiler = webpack(webpackConfig);
compiler.run((err, stats) => {
if (err) {
debug('Webpack compiler encountered a fatal error.', err);
// -----------------------------
// STARTING APP COMPILATION PROCESS
// -----------------------------
const compile = () => {
debug('Starting compiler.');
return Promise.resolve()
.then(() => webpackCompiler())
.then(() => {
debug('Compilation completed successfully.');
import React from 'react';
import ReactDOM from 'react-dom';
import RedBox from 'redbox-react';
import store from './controller/store';
import history from './controller/history';
import AppContainer from './containers/AppContainer';
const ENTRY_POINT = document.querySelector('#react-app-root');
import { applyMiddleware, compose, createStore } from 'redux';
import { routerMiddleware } from 'connected-react-router';
import initialState from './initialState';
import history from './history';
import { logger, makeRootReducer, sagaMiddleware as saga, rootSaga, runSaga } from './middleware';
// creating the root store config
const rootStore = () => {
const middleware = [];
// saga entry point - propbably you don't need this
import createSagaMiddleware from 'redux-saga';
import { all } from 'redux-saga/effects';
import createSagaMiddlewareHelpers from 'redux-saga-watch-actions/lib/middleware';
import watchSagas from '../../modules/saga';
const sagaMiddleware = createSagaMiddleware();
const runSaga = saga => sagaMiddleware.run(saga);
const { injectSaga, cancelTask } = createSagaMiddlewareHelpers(sagaMiddleware); // <-- bind to sagaMiddleware.run
import { put } from 'redux-saga/effects';
import { someAsyncAction } from '../actions';
export function* someSaga() {
try {
const payload = yield fetch('https://www.github.com');
// throw an error if no payload received
if (!payload) {
throw new Error('Error in payload!');
import { PropTypes } from 'prop-types';
import React from 'react';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'connected-react-router';
import CoreLayout from '../layout';
const AppContainer = ({ store, history }) => {
return (
<Provider store={store}>
import React from 'react';
import { Route, withRouter } from 'react-router-dom';
import { Header, Footer } from '../components';
import { Body } from '../containers/Wrappers';
import styles from '../styles/index.scss';
const CoreLayout = () => {
return (
{
"presets": [
"@babel/env",
"@babel/react",
"@babel/typescript"
],
"plugins": [
"@babel/plugin-transform-object-assign",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import"