diff --git a/.babelrc b/.babelrc index 0d25256b..07ee069b 100644 --- a/.babelrc +++ b/.babelrc @@ -3,7 +3,7 @@ [ "es2015", { - "modules": false + "modules": false } ], "react", @@ -11,6 +11,9 @@ ], "env": { "production": { + "plugins": [ + "transform-runtime" + ], "presets": [ "react-optimize" ] diff --git a/package.json b/package.json index 6fd27d90..07827dad 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/components/CephaloEditor/index.tsx b/src/components/CephaloEditor/index.tsx index a3c14464..061b11d3 100644 --- a/src/components/CephaloEditor/index.tsx +++ b/src/components/CephaloEditor/index.tsx @@ -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'; diff --git a/src/utils/image-worker.ts b/src/utils/image-worker.ts index cecb6a1c..687ab6af 100644 --- a/src/utils/image-worker.ts +++ b/src/utils/image-worker.ts @@ -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 { diff --git a/webpack.config.js b/webpack.config.js index 3f42a866..32cdd8f4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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); @@ -89,9 +95,14 @@ const config = { query: { transpileOnly: true, silent: true, - compilerOptions: { - module: 'es2015', - }, + compilerOptions: Object.assign( + { + module: 'es2015', + }, + env.isProd ? { + jsx: 'preserve', + } : { } + ), }, }, ]), @@ -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',