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
// home.js | |
import React from "react"; | |
export default () => ( | |
<div className="wrapper"> | |
<h2>Home</h2> | |
</div> | |
); |
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
const webpack = require("webpack"); | |
const path = require("path"); | |
const buildPath = path.resolve("build"); | |
module.exports = { | |
output: { | |
path: buildPath, | |
filename: "[name].[chunkhash:8].js", | |
chunkFilename: "[name].[chunkhash:8].chunk.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
const webpack = require("webpack"); | |
module.exports = { | |
entry: { | |
client: "./src/index.js", | |
vendor: ["react", "react-dom", "react-router", "react-router-dom"] | |
}, | |
plugins: [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: "vendor", |
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
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; | |
module.exports = { | |
plugins: [new BundleAnalyzerPlugin()] | |
}; |
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
const webpack = require("webpack"); | |
module.exports = { | |
plugins: [ | |
new webpack.optimize.UglifyJsPlugin({ | |
/* settings */ | |
}) | |
] | |
}; |
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
const webpack = require("webpack"); | |
module.exports = { | |
plugins: [ | |
new webpack.DefinePlugin({ | |
"process.env": { | |
NODE_ENV: JSON.stringify("production") | |
} | |
}) | |
] |
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
loader: ExtractTextPlugin.extract({ | |
use: [ | |
{ | |
loader: require.resolve("css-loader"), | |
options: { | |
minimize: true | |
} | |
} | |
] | |
}); |
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
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
oneOf: [ | |
{ | |
test: /\.css$/, | |
loader: ExtractTextPlugin.extract({ |
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
const validateStatusCode = response => | |
new Promise((resolve, reject) => { | |
const status = response.status; | |
const next = status < 400 ? resolve : reject; | |
response.text().then(next); | |
}); | |
export const makePrediction = image => | |
fetch("/api/predict", { | |
method: "POST", |
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, { Component } from "react"; | |
import logo from "./assets/logo.svg"; | |
import "./assets/App.css"; | |
import { SketchField, Tools } from "react-sketch"; | |
import { makePrediction } from "./api"; | |
const pixels = count => `${count}px`; | |
const percents = count => `${count}px`; | |
const MAIN_CONTAINER_WIDTH_PX = 200; |