This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ----------------------------- | |
| // 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ----------------------------- | |
| // STARTING APP COMPILATION PROCESS | |
| // ----------------------------- | |
| const compile = () => { | |
| debug('Starting compiler.'); | |
| return Promise.resolve() | |
| .then(() => webpackCompiler()) | |
| .then(() => { | |
| debug('Compilation completed successfully.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "presets": [ | |
| "@babel/env", | |
| "@babel/react", | |
| "@babel/typescript" | |
| ], | |
| "plugins": [ | |
| "@babel/plugin-transform-object-assign", | |
| "@babel/plugin-proposal-class-properties", | |
| "@babel/plugin-syntax-dynamic-import" |