Skip to content

Instantly share code, notes, and snippets.

@rsteckler
Created January 27, 2016 04:55
Show Gist options
  • Save rsteckler/22e765f94852f95b86b7 to your computer and use it in GitHub Desktop.
Save rsteckler/22e765f94852f95b86b7 to your computer and use it in GitHub Desktop.
{
"private": true,
"engines": {
"node": ">=5.0 <6",
"npm": ">=3.3 <4"
},
"dependencies": {
"babel-polyfill": "^6.3.14",
"babel-runtime": "^6.3.19",
"bluebird": "3.1.4",
"classnames": "2.2.3",
"eventemitter3": "1.1.1",
"express": "4.13.4",
"fastclick": "1.0.6",
"fbjs": "0.6.1",
"flexboxgrid": "^6.3.0",
"front-matter": "2.0.5",
"history": "2.0.0-rc2",
"isomorphic-style-loader": "0.0.7",
"jade": "1.11.0",
"material-ui": "^0.14.2",
"node-fetch": "1.3.3",
"normalize.css": "3.0.3",
"react": "0.14.6",
"react-dom": "0.14.6",
"react-flexbox-grid": "^0.9.2",
"react-routing": "0.0.7",
"sass-loader": "^3.1.2",
"source-map-support": "0.4.0",
"whatwg-fetch": "0.11.0"
},
"devDependencies": {
"assets-webpack-plugin": "^3.2.0",
"autoprefixer": "^6.3.1",
"babel-cli": "^6.4.5",
"babel-eslint": "^5.0.0-beta6",
"babel-loader": "^6.2.1",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-runtime": "^6.4.3",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"browser-sync": "^2.11.1",
"css-loader": "^0.23.1",
"csscomb": "^3.1.8",
"del": "^2.2.0",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^4.0.0",
"eslint-loader": "^1.2.0",
"eslint-plugin-react": "^3.15.0",
"extend": "^3.0.0",
"file-loader": "^0.8.5",
"gaze": "^0.5.2",
"git-repository": "^0.1.1",
"glob": "^6.0.4",
"jest-cli": "^0.8.2",
"jscs": "^2.8.0",
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"postcss": "^5.0.14",
"postcss-import": "^7.1.3",
"postcss-loader": "^0.8.0",
"precss": "^1.4.0",
"raw-loader": "^0.5.1",
"react-transform-catch-errors": "^1.0.1",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.2.0",
"replace": "^0.3.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.11",
"webpack-hot-middleware": "^2.6.0",
"webpack-middleware": "^1.4.0"
},
"jest": {
"rootDir": "./src",
"scriptPreprocessor": "../preprocessor.js",
"unmockedModulePathPatterns": [
"fbjs",
"react"
]
},
"scripts": {
"lint": "eslint src tools && jscs src tools",
"csslint": "csscomb src/components --lint --verbose",
"csscomb": "csscomb src/components --verbose",
"test": "eslint src && jest",
"clean": "babel-node tools/run clean",
"copy": "babel-node tools/run copy",
"bundle": "babel-node tools/run bundle",
"build": "babel-node tools/run build",
"deploy": "babel-node tools/run deploy",
"start": "babel-node tools/run start"
}
}
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import path from 'path';
import webpack from 'webpack';
import extend from 'extend';
import AssetsPlugin from 'assets-webpack-plugin';
const DEBUG = !process.argv.includes('--release');
const VERBOSE = process.argv.includes('--verbose');
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
'Android >= 4',
'Chrome >= 35',
'Firefox >= 31',
'Explorer >= 9',
'iOS >= 7',
'Opera >= 12',
'Safari >= 7.1',
];
const GLOBALS = {
'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
__DEV__: DEBUG,
};
//
// Common configuration chunk to be used for both
// client-side (client.js) and server-side (server.js) bundles
// -----------------------------------------------------------------------------
const config = {
output: {
publicPath: '/',
sourcePrefix: ' ',
},
cache: DEBUG,
debug: DEBUG,
stats: {
colors: true,
reasons: DEBUG,
hash: VERBOSE,
version: VERBOSE,
timings: true,
chunks: VERBOSE,
chunkModules: VERBOSE,
cached: VERBOSE,
cachedAssets: VERBOSE,
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
],
resolve: {
extensions: ['', '.scss', '.webpack.js', '.web.js', '.js', '.jsx', '.json'],
},
module: {
loaders: [
{
test: /\.jsx?$/,
include: [
path.resolve(__dirname, '../node_modules/react-routing/src'),
path.resolve(__dirname, '../src'),
],
loader: 'babel-loader',
}, {
test: /\.scss$/,
loaders: [
'isomorphic-style-loader',
`css-loader?${DEBUG ? 'sourceMap&' : 'minimize&'}modules&localIdentName=` +
`${DEBUG ? '[name]_[local]_[hash:base64:3]' : '[hash:base64:4]'}`,
'postcss-loader',
],
}, {
test: /\.json$/,
loader: 'json-loader',
}, {
test: /\.txt$/,
loader: 'raw-loader',
}, {
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
loader: 'url-loader?limit=10000',
}, {
test: /\.(eot|ttf|wav|mp3)$/,
loader: 'file-loader',
},
],
},
postcss: function plugins(bundler) {
return [
require('postcss-import')({ addDependencyTo: bundler }),
require('precss')(),
require('autoprefixer')({ browsers: AUTOPREFIXER_BROWSERS }),
];
},
};
//
// Configuration for the client-side bundle (client.js)
// -----------------------------------------------------------------------------
const clientConfig = extend(true, {}, config, {
entry: './src/client.js',
output: {
path: path.join(__dirname, '../build/public'),
filename: DEBUG ? '[name].js?[hash]' : '[name].[hash].js',
},
// Choose a developer tool to enhance debugging
// http://webpack.github.io/docs/configuration.html#devtool
devtool: DEBUG ? 'cheap-module-eval-source-map' : false,
plugins: [
new webpack.DefinePlugin(GLOBALS),
new AssetsPlugin({
path: path.join(__dirname, '../build'),
filename: 'assets.js',
processOutput: x => `module.exports = ${JSON.stringify(x)};`,
}),
...(!DEBUG ? [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
screw_ie8: true,
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
warnings: VERBOSE,
},
}),
new webpack.optimize.AggressiveMergingPlugin(),
] : []),
],
});
//
// Configuration for the server-side bundle (server.js)
// -----------------------------------------------------------------------------
const serverConfig = extend(true, {}, config, {
entry: './src/server.js',
output: {
path: './build',
filename: 'server.js',
libraryTarget: 'commonjs2',
},
target: 'node',
externals: [
/^\.\/assets$/,
function filter(context, request, cb) {
const isExternal =
request.match(/^[@a-z][a-z\/\.\-0-9]*$/i) &&
!request.match(/^react-routing/) &&
!context.match(/[\\/]react-routing/);
cb(null, Boolean(isExternal));
},
],
node: {
console: false,
global: false,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
},
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin(GLOBALS),
new webpack.BannerPlugin('require("source-map-support").install();',
{ raw: true, entryOnly: false }),
],
});
export default [clientConfig, serverConfig];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment