This file contains 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
const webpack = require("webpack"); | |
webpack({ | |
// Configuration Object | |
}, (err, stats) => { | |
if (err || stats.hasErrors()) { | |
// Handle errors here | |
} | |
// Done processing | |
}); |
This file contains 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
'use strict'; | |
console.log('Running app build'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const StatsPlugin = require('stats-webpack-plugin'); | |
const { compile } = require('./webpack.utils.js'); |
This file contains 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
'use strict'; | |
const webpackAppCodeConfig = './webpack/concurrent/webpack.concurrent-app.js'; | |
const webpackAppStylesConfig = './webpack/concurrent/webpack.concurrent-styles.js'; | |
const NODE_ENV = process.env.NODE_ENV || 'development'; | |
const BUILD_PIPELINE = [ webpackAppStylesConfig, webpackAppCodeConfig ]; | |
console.log(`Running webpack build through API. Env [${NODE_ENV}]`); |
This file contains 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
'use strict'; | |
const path = require('path'); | |
const webpack = require('webpack'); | |
module.exports = { | |
entry: [ | |
path.join(__dirname, 'src/index.js'), | |
], | |
devtool: 'eval-source-map', |
This file contains 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
'use strict'; | |
const webpack = require('webpack'); | |
const path = require('path'); | |
const vendorLibs = [ | |
'lodash', | |
'moment', | |
'react', | |
'react-dom', |
This file contains 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
const DEFAULT_METHODS = ['constructor', 'render', 'componentDidMount', 'componentDidUpdate']; | |
class App extends React.Component { | |
constructor() { | |
super(); | |
this.bindMethodsWithContext(this); | |
} | |
This file contains 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
class App extends React.Component { | |
constructor() { | |
super(); | |
this.methodA = this.methodA.bind(this); | |
this.methodB = this.methodB.bind(this); | |
this.methodC = this.methodC.bind(this); | |
} | |
This file contains 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
let o1, o2, o3, | |
obj = multiInherit(o1={a:1}, o2={b:2}, o3={a:3, b:3}); |
This file contains 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
// Taken from https://stackoverflow.com/questions/9163341/multiple-inheritance-prototypes-in-javascript | |
function getDesc (obj, prop) { | |
let desc = Object.getOwnPropertyDescriptor(obj, prop); | |
return desc || (obj=Object.getPrototypeOf(obj) ? getDesc(obj, prop) : void 0); | |
} | |
function multiInherit (...protos) { | |
return Object.create(new Proxy(Object.create(null), { | |
has: (target, prop) => protos.some(obj => prop in obj), |
This file contains 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
const path = require('path'); | |
const express = require('express'); | |
const webpack = require('webpack'); | |
const webpackDevMiddleware = require('webpack-dev-middleware'); | |
const webpackHotMiddleware = require('webpack-hot-middleware'); | |
const port = 3000; | |
const config = require(`./webpack.${process.env.NODE_ENV}.config.js`); | |
const isDevMode = process.env.NODE_ENV !== 'production'; |