From 97f083d57dfe180f5e27306fccc94c9eb3b7f5a6 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 5 Oct 2016 14:00:27 -0700 Subject: [PATCH] Always add add-module-exports --- lib/utils/babel-config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/utils/babel-config.js b/lib/utils/babel-config.js index 27d0a26f847f8..ed5ef60c11461 100644 --- a/lib/utils/babel-config.js +++ b/lib/utils/babel-config.js @@ -127,11 +127,21 @@ export default function babelConfig (program, stage) { findBabelPackage(directory) || defaultConfig() + // If using the user's babelrc, they might not have a plugin array. + if (!babelrc.plugins) { + babelrc.plugins = [] + } + if (stage === `develop`) { babelrc.plugins.unshift(`transform-react-jsx-source`) babelrc.plugins.unshift(`react-hot-loader/babel`) } + // Always add this plugin so our generated routes + // will work regardless of how users export + // their components. Yeah for multiple module standards! + babelrc.plugins.unshift(`add-module-exports`) + if (!babelrc.hasOwnProperty(`cacheDirectory`)) { babelrc.cacheDirectory = true }