about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNolan Lawson <nolan@nolanlawson.com>2017-05-05 19:18:23 -0700
committerEugen Rochko <eugen@zeonfederated.com>2017-05-06 04:18:23 +0200
commit37caf0b36e90e7ec6219dcaaf6cdf4e1a2825cce (patch)
treebb24703668f901a16c116e531cc938ea621e36f0
parentcf0b7532097e7a59d59ea71a89ba39f8a4ab62ad (diff)
separate .babelrc for prod/dev, add babel-plugin-lodash (#2829)
-rw-r--r--.babelrc17
-rw-r--r--config/webpack/loaders/babel.js5
-rw-r--r--package.json1
-rw-r--r--yarn.lock7
4 files changed, 26 insertions, 4 deletions
diff --git a/.babelrc b/.babelrc
index 2c4d9aab3..65155184d 100644
--- a/.babelrc
+++ b/.babelrc
@@ -11,8 +11,6 @@
     ]
   ],
   "plugins": [
-    "transform-react-jsx-source",
-    "transform-react-jsx-self",
     "transform-decorators-legacy",
     "transform-object-rest-spread",
     [
@@ -21,5 +19,18 @@
         "messagesDir": "./build/messages"
       }
     ]
-  ]
+  ],
+  "env": {
+    "development": {
+      "plugins": [
+        "transform-react-jsx-source",
+        "transform-react-jsx-self"
+      ]
+    },
+    "production": {
+      "plugins": [
+        "lodash"
+      ]
+    }
+  }
 }
diff --git a/config/webpack/loaders/babel.js b/config/webpack/loaders/babel.js
index c608e708f..e58d0633e 100644
--- a/config/webpack/loaders/babel.js
+++ b/config/webpack/loaders/babel.js
@@ -1,5 +1,8 @@
 module.exports = {
   test: /\.js(\.erb)?$/,
   exclude: /node_modules/,
-  loader: 'babel-loader'
+  loader: 'babel-loader',
+  options: {
+    forceEnv: process.env.NODE_ENV || 'development'
+  }
 }
diff --git a/package.json b/package.json
index 2475918b1..97fae3379 100644
--- a/package.json
+++ b/package.json
@@ -108,6 +108,7 @@
   "devDependencies": {
     "@kadira/storybook": "^2.35.3",
     "babel-eslint": "^7.2.2",
+    "babel-plugin-lodash": "^3.2.11",
     "chai": "^3.5.0",
     "chai-enzyme": "^0.6.1",
     "enzyme": "^2.8.2",
diff --git a/yarn.lock b/yarn.lock
index ba0430c66..4394cb4fa 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -627,6 +627,13 @@ babel-plugin-check-es2015-constants@^6.22.0, babel-plugin-check-es2015-constants
   dependencies:
     babel-runtime "^6.22.0"
 
+babel-plugin-lodash@^3.2.11:
+  version "3.2.11"
+  resolved "https://registry.yarnpkg.com/babel-plugin-lodash/-/babel-plugin-lodash-3.2.11.tgz#21c8fdec9fe1835efaa737873e3902bdd66d5701"
+  dependencies:
+    glob "^7.1.1"
+    lodash "^4.17.2"
+
 babel-plugin-react-docgen@^1.4.2:
   version "1.4.2"
   resolved "https://registry.yarnpkg.com/babel-plugin-react-docgen/-/babel-plugin-react-docgen-1.4.2.tgz#04c02133b84b6cc182d35de2162f15764da03e7c"