Skip to content

Commit

Permalink
Clean ups and production fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
forabi committed Sep 13, 2016
1 parent c027672 commit 187dbe5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
[
"es2015",
{
"modules": false
"modules": false
}
],
"react",
"stage-3"
],
"env": {
"production": {
"plugins": [
"transform-runtime"
],
"presets": [
"react-optimize"
]
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "mocha src/**/*.test.* --compilers ts:ts-node/register,tsx:ts-node/register",
"webpack:validate": "webpack-validator webpack.config.js",
"dev": "NODE_ENV=development HOT=1 babel-node devServer.js",
"prod": "rm -rf build/**/* && NODE_ENV=production webpack"
"prod": "rm -rf build/**/*.{js,jpg,png,svg,html,log,css} && NODE_ENV=production webpack --bail --progress"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -51,6 +51,7 @@
"babel-cli": "^6.11.4",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
"babel-preset-react-optimize": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CephaloEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import CircularProgress from 'material-ui/CircularProgress';
import Snackbar from 'material-ui/Snackbar';
import Divider from 'material-ui/Divider';
import Checkbox from 'material-ui/Checkbox';
import * as cx from 'classnames';
import cx from 'classnames';
import { getStepsForAnalysis } from '../../analyses/helpers';
import downs from '../../analyses/downs';
import AnalysisStepper from '../AnalysisStepper';
Expand Down
1 change: 0 additions & 1 deletion src/utils/image-worker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import bluebird from 'bluebird';
import Jimp from './jimp';
import { ErrorCode } from './constants';
import assign from 'lodash/assign';
import { doesLookLikeCephalometricRadiograph } from './image';
import { readFileAsBuffer } from './file';
import {
Expand Down
25 changes: 18 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ const fail = require('webpack-fail-plugin');
const path = require('path');
const env = require('./env');
const WebpackHTMLPlugin = require('webpack-html-plugin');
const Dashboard = require('webpack-dashboard');
const DashboardPlugin = require('webpack-dashboard/plugin');
const { compact } = require('lodash');

const dashboard = new Dashboard();
let Dashboard;
let DashboardPlugin;
let dashboard;

if (env.isDev) {
Dashboard = require('webpack-dashboard');
DashboardPlugin = require('webpack-dashboard/plugin');
dashboard = new Dashboard();
}

const prod = p => (env.isProd ? p : null);
const hot = p => (env.isHot ? p : null);
Expand Down Expand Up @@ -89,9 +95,14 @@ const config = {
query: {
transpileOnly: true,
silent: true,
compilerOptions: {
module: 'es2015',
},
compilerOptions: Object.assign(
{
module: 'es2015',
},
env.isProd ? {
jsx: 'preserve',
} : { }
),
},
},
]),
Expand Down Expand Up @@ -141,7 +152,7 @@ const config = {

plugins: compact([
hot(new webpack.HotModuleReplacementPlugin()),
dev(new DashboardPlugin(dashboard.setData)),
dashboard ? new DashboardPlugin(dashboard.setData) : null,
fail,
new WebpackHTMLPlugin({
filename: 'index.html',
Expand Down

0 comments on commit 187dbe5

Please sign in to comment.