diff --git a/package.json b/package.json index e055eefe..f6937920 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "babel-plugin-transform-es2015-modules-commonjs": "6.22.0", "babel-plugin-transform-object-rest-spread": "6.22.0", "babel-plugin-transform-react-constant-elements": "^6.22.0", + "babel-plugin-transform-react-jsx-source": "^6.22.0", "babel-plugin-transform-react-remove-prop-types": "^0.3.2", "babel-plugin-transform-runtime": "6.22.0", "babel-preset-latest": "6.22.0", diff --git a/server/build/babel/preset.js b/server/build/babel/preset.js index e48fa4d2..83b93ff8 100644 --- a/server/build/babel/preset.js +++ b/server/build/babel/preset.js @@ -1,11 +1,17 @@ -const isProduction = process.env.NODE_ENV === 'production' const babelRuntimePath = require.resolve('babel-runtime/package') .replace(/[\\/]package\.json$/, '') -const productionPlugins = isProduction ? [ - require.resolve('babel-plugin-transform-react-constant-elements'), - require.resolve('babel-plugin-transform-react-remove-prop-types') -] : [] +const envPlugins = { + 'development': [ + require.resolve('babel-plugin-transform-react-jsx-source') + ], + 'production': [ + require.resolve('babel-plugin-transform-react-constant-elements'), + require.resolve('babel-plugin-transform-react-remove-prop-types') + ] +} + +const plugins = envPlugins[process.env.NODE_ENV] || [] module.exports = { presets: [ @@ -20,7 +26,7 @@ module.exports = { require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-runtime'), require.resolve('styled-jsx/babel'), - ...productionPlugins, + ...plugins, [ require.resolve('babel-plugin-module-resolver'), { diff --git a/yarn.lock b/yarn.lock index a1e5a13a..afda02d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -729,7 +729,7 @@ babel-plugin-transform-react-jsx-self@^6.22.0: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx-source@^6.22.0: +babel-plugin-transform-react-jsx-source, babel-plugin-transform-react-jsx-source@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6" dependencies: