<p dir="auto">This is a bug report</p>

<h3 dir="auto">Input Code</h3>


<p dir="auto">Simplified version of the problematic file that still crashes:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// @flow

import React from 'react';
import { Switch, Route } from 'react-router-dom';

import SubscriberRoutes from './SubscriberRoutes';
import NotFoundPage from '../App/NotFoundPage';

type Props = {
  modules: string[],
};

export default function AppRoutes ({ modules }: Props) {
  return (
    &lt;Switch&gt;
      &lt;Route
        render={() =&gt; &lt;SubscriberRoutes modules={modules} /&gt;}
      /&gt;
      &lt;Route component={NotFoundPage} /&gt;
    &lt;/Switch&gt;
  );
}"><pre class="notranslate"><span class="pl-c">// <span class="pl-k">@flow</span></span>

<span class="pl-k">import</span> <span class="pl-v">React</span> <span class="pl-k">from</span> <span class="pl-s">'react'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-v">Switch</span><span class="pl-kos">,</span> <span class="pl-v">Route</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'react-router-dom'</span><span class="pl-kos">;</span>

<span class="pl-k">import</span> <span class="pl-v">SubscriberRoutes</span> <span class="pl-k">from</span> <span class="pl-s">'./SubscriberRoutes'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-v">NotFoundPage</span> <span class="pl-k">from</span> <span class="pl-s">'../App/NotFoundPage'</span><span class="pl-kos">;</span>

<span class="pl-s1">type</span> <span class="pl-v">Props</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">modules</span>: <span class="pl-s1">string</span><span class="pl-kos">[</span><span class="pl-s1"></span><span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">function</span> <span class="pl-v">AppRoutes</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> modules <span class="pl-kos">}</span>: <span class="pl-v">Props</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-kos">(</span>
    <span class="pl-c1">&lt;</span><span class="pl-ent">Switch</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-ent">Route</span>
        <span class="pl-c1">render</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-c1">&lt;</span><span class="pl-ent">SubscriberRoutes</span> <span class="pl-c1">modules</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-s1">modules</span><span class="pl-kos">}</span> <span class="pl-c1">/</span><span class="pl-c1">&gt;</span><span class="pl-kos">}</span>
      <span class="pl-c1">/</span><span class="pl-c1">&gt;</span>
      <span class="pl-c1">&lt;</span><span class="pl-ent">Route</span> <span class="pl-c1">component</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-v">NotFoundPage</span><span class="pl-kos">}</span> <span class="pl-c1">/</span><span class="pl-c1">&gt;</span>
    <span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">Switch</span><span class="pl-c1">&gt;</span>
  <span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Babel/Babylon Configuration (.babelrc, package.json, cli command)</h3>

<p dir="auto">I'm compiling with Webpack and I have no <code class="notranslate">.babelrc</code>. This is my config that I pass to <code class="notranslate">babel-loader</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  presets: [
    ['env', { modules: false }],
    'stage-2',
    'react',
  ],
  plugins: [
    'transform-react-constant-elements',
  ],
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">presets</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'env'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">modules</span>: <span class="pl-c1">false</span> <span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-s">'stage-2'</span><span class="pl-kos">,</span>
    <span class="pl-s">'react'</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span>
    <span class="pl-s">'transform-react-constant-elements'</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>


<p dir="auto">I think it should compile. Have I done anything wrong or is this a bug? Removing <code class="notranslate">transform-react-constant-elements</code> makes it work.</p>
<h3 dir="auto">Current Behavior</h3>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR in ./src/components/Routes/AppRoutes.js
Module parse failed: Unexpected token (9:34)
You may need an appropriate loader to handle this file type.
| var _ref3 = React.createElement(Route, { component: NotFoundPage });
|
| export default function AppRoutes((_temp = _ref, _ref2 = &lt;SubscriberRoutes modules={modules} /&gt;, _temp)) {
|   var _temp, _ref2;
|
 @ ./src/components/Login/LoginWall.js 5:0-44 9:32-41
 @ ./src/components/App/App.js
 @ ./src/index.js
 @ multi babel-polyfill ./src"><pre class="notranslate"><code class="notranslate">ERROR in ./src/components/Routes/AppRoutes.js
Module parse failed: Unexpected token (9:34)
You may need an appropriate loader to handle this file type.
| var _ref3 = React.createElement(Route, { component: NotFoundPage });
|
| export default function AppRoutes((_temp = _ref, _ref2 = &lt;SubscriberRoutes modules={modules} /&gt;, _temp)) {
|   var _temp, _ref2;
|
 @ ./src/components/Login/LoginWall.js 5:0-44 9:32-41
 @ ./src/components/App/App.js
 @ ./src/index.js
 @ multi babel-polyfill ./src
</code></pre></div>
<h3 dir="auto">Possible Solution</h3>


<h3 dir="auto">Context</h3>


<p dir="auto">I'm trying to build my app with Webpack.</p>
<h3 dir="auto">Your Environment</h3>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="yarn list --pattern babel
yarn list v1.5.1
├─ @babel/code-frame@7.0.0-beta.40
├─ @babel/generator@7.0.0-beta.40
├─ @babel/helper-function-name@7.0.0-beta.40
├─ @babel/helper-get-function-arity@7.0.0-beta.40
├─ @babel/highlight@7.0.0-beta.40
├─ @babel/template@7.0.0-beta.40
├─ @babel/traverse@7.0.0-beta.40
├─ @babel/types@7.0.0-beta.40
├─ babel-code-frame@6.26.0
├─ babel-core@6.26.0
├─ babel-eslint@8.2.2
├─ babel-generator@6.26.1
├─ babel-helper-bindify-decorators@6.24.1
├─ babel-helper-builder-binary-assignment-operator-visitor@6.24.1
├─ babel-helper-builder-react-jsx@6.26.0
├─ babel-helper-call-delegate@6.24.1
├─ babel-helper-define-map@6.26.0
├─ babel-helper-explode-assignable-expression@6.24.1
├─ babel-helper-explode-class@6.24.1
├─ babel-helper-function-name@6.24.1
├─ babel-helper-get-function-arity@6.24.1
├─ babel-helper-hoist-variables@6.24.1
├─ babel-helper-optimise-call-expression@6.24.1
├─ babel-helper-regex@6.26.0
├─ babel-helper-remap-async-to-generator@6.24.1
├─ babel-helper-replace-supers@6.24.1
├─ babel-helpers@6.24.1
├─ babel-jest@22.4.1
├─ babel-loader@7.1.4
├─ babel-messages@6.23.0
├─ babel-plugin-check-es2015-constants@6.22.0
├─ babel-plugin-istanbul@4.1.5
├─ babel-plugin-jest-hoist@22.4.1
├─ babel-plugin-react-remove-properties@0.2.5
├─ babel-plugin-syntax-async-functions@6.13.0
├─ babel-plugin-syntax-async-generators@6.13.0
├─ babel-plugin-syntax-class-constructor-call@6.18.0
├─ babel-plugin-syntax-class-properties@6.13.0
├─ babel-plugin-syntax-decorators@6.13.0
├─ babel-plugin-syntax-dynamic-import@6.18.0
├─ babel-plugin-syntax-exponentiation-operator@6.13.0
├─ babel-plugin-syntax-export-extensions@6.13.0
├─ babel-plugin-syntax-flow@6.18.0
├─ babel-plugin-syntax-jsx@6.18.0
├─ babel-plugin-syntax-object-rest-spread@6.13.0
├─ babel-plugin-syntax-trailing-function-commas@6.22.0
├─ babel-plugin-transform-async-generator-functions@6.24.1
├─ babel-plugin-transform-async-to-generator@6.24.1
├─ babel-plugin-transform-class-constructor-call@6.24.1
├─ babel-plugin-transform-class-properties@6.24.1
├─ babel-plugin-transform-decorators@6.24.1
├─ babel-plugin-transform-es2015-arrow-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoped-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoping@6.26.0
├─ babel-plugin-transform-es2015-classes@6.24.1
├─ babel-plugin-transform-es2015-computed-properties@6.24.1
├─ babel-plugin-transform-es2015-destructuring@6.23.0
├─ babel-plugin-transform-es2015-duplicate-keys@6.24.1
├─ babel-plugin-transform-es2015-for-of@6.23.0
├─ babel-plugin-transform-es2015-function-name@6.24.1
├─ babel-plugin-transform-es2015-literals@6.22.0
├─ babel-plugin-transform-es2015-modules-amd@6.24.1
├─ babel-plugin-transform-es2015-modules-commonjs@6.26.0
├─ babel-plugin-transform-es2015-modules-systemjs@6.24.1
├─ babel-plugin-transform-es2015-modules-umd@6.24.1
├─ babel-plugin-transform-es2015-object-super@6.24.1
├─ babel-plugin-transform-es2015-parameters@6.24.1
├─ babel-plugin-transform-es2015-shorthand-properties@6.24.1
├─ babel-plugin-transform-es2015-spread@6.22.0
├─ babel-plugin-transform-es2015-sticky-regex@6.24.1
├─ babel-plugin-transform-es2015-template-literals@6.22.0
├─ babel-plugin-transform-es2015-typeof-symbol@6.23.0
├─ babel-plugin-transform-es2015-unicode-regex@6.24.1
├─ babel-plugin-transform-exponentiation-operator@6.24.1
├─ babel-plugin-transform-export-extensions@6.22.0
├─ babel-plugin-transform-flow-strip-types@6.22.0
├─ babel-plugin-transform-object-rest-spread@6.26.0
├─ babel-plugin-transform-react-constant-elements@6.23.0
├─ babel-plugin-transform-react-display-name@6.25.0
├─ babel-plugin-transform-react-inline-elements@6.22.0
├─ babel-plugin-transform-react-jsx-self@6.22.0
├─ babel-plugin-transform-react-jsx-source@6.22.0
├─ babel-plugin-transform-react-jsx@6.24.1
├─ babel-plugin-transform-react-remove-prop-types@0.4.13
├─ babel-plugin-transform-regenerator@6.26.0
├─ babel-plugin-transform-strict-mode@6.24.1
├─ babel-polyfill@6.26.0
├─ babel-preset-env@1.6.1
├─ babel-preset-es2015@6.24.1
├─ babel-preset-flow@6.23.0
├─ babel-preset-jest@22.4.1
├─ babel-preset-react@6.24.1
├─ babel-preset-stage-1@6.24.1
├─ babel-preset-stage-2@6.24.1
├─ babel-preset-stage-3@6.24.1
├─ babel-register@6.26.0
├─ babel-runtime@6.26.0
├─ babel-template@6.26.0
├─ babel-traverse@6.26.0
└─ babel-types@6.26.0"><pre class="notranslate"><code class="notranslate">yarn list --pattern babel
yarn list v1.5.1
├─ @babel/code-frame@7.0.0-beta.40
├─ @babel/generator@7.0.0-beta.40
├─ @babel/helper-function-name@7.0.0-beta.40
├─ @babel/helper-get-function-arity@7.0.0-beta.40
├─ @babel/highlight@7.0.0-beta.40
├─ @babel/template@7.0.0-beta.40
├─ @babel/traverse@7.0.0-beta.40
├─ @babel/types@7.0.0-beta.40
├─ babel-code-frame@6.26.0
├─ babel-core@6.26.0
├─ babel-eslint@8.2.2
├─ babel-generator@6.26.1
├─ babel-helper-bindify-decorators@6.24.1
├─ babel-helper-builder-binary-assignment-operator-visitor@6.24.1
├─ babel-helper-builder-react-jsx@6.26.0
├─ babel-helper-call-delegate@6.24.1
├─ babel-helper-define-map@6.26.0
├─ babel-helper-explode-assignable-expression@6.24.1
├─ babel-helper-explode-class@6.24.1
├─ babel-helper-function-name@6.24.1
├─ babel-helper-get-function-arity@6.24.1
├─ babel-helper-hoist-variables@6.24.1
├─ babel-helper-optimise-call-expression@6.24.1
├─ babel-helper-regex@6.26.0
├─ babel-helper-remap-async-to-generator@6.24.1
├─ babel-helper-replace-supers@6.24.1
├─ babel-helpers@6.24.1
├─ babel-jest@22.4.1
├─ babel-loader@7.1.4
├─ babel-messages@6.23.0
├─ babel-plugin-check-es2015-constants@6.22.0
├─ babel-plugin-istanbul@4.1.5
├─ babel-plugin-jest-hoist@22.4.1
├─ babel-plugin-react-remove-properties@0.2.5
├─ babel-plugin-syntax-async-functions@6.13.0
├─ babel-plugin-syntax-async-generators@6.13.0
├─ babel-plugin-syntax-class-constructor-call@6.18.0
├─ babel-plugin-syntax-class-properties@6.13.0
├─ babel-plugin-syntax-decorators@6.13.0
├─ babel-plugin-syntax-dynamic-import@6.18.0
├─ babel-plugin-syntax-exponentiation-operator@6.13.0
├─ babel-plugin-syntax-export-extensions@6.13.0
├─ babel-plugin-syntax-flow@6.18.0
├─ babel-plugin-syntax-jsx@6.18.0
├─ babel-plugin-syntax-object-rest-spread@6.13.0
├─ babel-plugin-syntax-trailing-function-commas@6.22.0
├─ babel-plugin-transform-async-generator-functions@6.24.1
├─ babel-plugin-transform-async-to-generator@6.24.1
├─ babel-plugin-transform-class-constructor-call@6.24.1
├─ babel-plugin-transform-class-properties@6.24.1
├─ babel-plugin-transform-decorators@6.24.1
├─ babel-plugin-transform-es2015-arrow-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoped-functions@6.22.0
├─ babel-plugin-transform-es2015-block-scoping@6.26.0
├─ babel-plugin-transform-es2015-classes@6.24.1
├─ babel-plugin-transform-es2015-computed-properties@6.24.1
├─ babel-plugin-transform-es2015-destructuring@6.23.0
├─ babel-plugin-transform-es2015-duplicate-keys@6.24.1
├─ babel-plugin-transform-es2015-for-of@6.23.0
├─ babel-plugin-transform-es2015-function-name@6.24.1
├─ babel-plugin-transform-es2015-literals@6.22.0
├─ babel-plugin-transform-es2015-modules-amd@6.24.1
├─ babel-plugin-transform-es2015-modules-commonjs@6.26.0
├─ babel-plugin-transform-es2015-modules-systemjs@6.24.1
├─ babel-plugin-transform-es2015-modules-umd@6.24.1
├─ babel-plugin-transform-es2015-object-super@6.24.1
├─ babel-plugin-transform-es2015-parameters@6.24.1
├─ babel-plugin-transform-es2015-shorthand-properties@6.24.1
├─ babel-plugin-transform-es2015-spread@6.22.0
├─ babel-plugin-transform-es2015-sticky-regex@6.24.1
├─ babel-plugin-transform-es2015-template-literals@6.22.0
├─ babel-plugin-transform-es2015-typeof-symbol@6.23.0
├─ babel-plugin-transform-es2015-unicode-regex@6.24.1
├─ babel-plugin-transform-exponentiation-operator@6.24.1
├─ babel-plugin-transform-export-extensions@6.22.0
├─ babel-plugin-transform-flow-strip-types@6.22.0
├─ babel-plugin-transform-object-rest-spread@6.26.0
├─ babel-plugin-transform-react-constant-elements@6.23.0
├─ babel-plugin-transform-react-display-name@6.25.0
├─ babel-plugin-transform-react-inline-elements@6.22.0
├─ babel-plugin-transform-react-jsx-self@6.22.0
├─ babel-plugin-transform-react-jsx-source@6.22.0
├─ babel-plugin-transform-react-jsx@6.24.1
├─ babel-plugin-transform-react-remove-prop-types@0.4.13
├─ babel-plugin-transform-regenerator@6.26.0
├─ babel-plugin-transform-strict-mode@6.24.1
├─ babel-polyfill@6.26.0
├─ babel-preset-env@1.6.1
├─ babel-preset-es2015@6.24.1
├─ babel-preset-flow@6.23.0
├─ babel-preset-jest@22.4.1
├─ babel-preset-react@6.24.1
├─ babel-preset-stage-1@6.24.1
├─ babel-preset-stage-2@6.24.1
├─ babel-preset-stage-3@6.24.1
├─ babel-register@6.26.0
├─ babel-runtime@6.26.0
├─ babel-template@6.26.0
├─ babel-traverse@6.26.0
└─ babel-types@6.26.0
</code></pre></div>
<table role="table">
<thead>
<tr>
<th>software</th>
<th>version(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>6.26.0</td>
</tr>
<tr>
<td>Webpack</td>
<td>4.1.1</td>
</tr>
<tr>
<td>node</td>
<td>9.7.1</td>
</tr>
<tr>
<td>yarn</td>
<td>1.5.1</td>
</tr>
<tr>
<td>Operating System</td>
<td>macOS 10.13.3</td>
</tr>
</tbody>
</table>
<p dir="auto">Could the property descriptors passed to decorators be extended to hold type information, like they are for initializers?</p>