Issue 1:
This is a bug report

Input Code

Simplified version of the problematic file that still crashes:

// @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 (
<Switch>
<Route
render={() => <SubscriberRoutes modules={modules} />}
/>
<Route component={NotFoundPage} />
</Switch>
);
}

Babel/Babylon Configuration (.babelrc, package.json, cli command)

I'm compiling with Webpack and I have no .babelrc. This is my config that I pass to babel-loader:

{
presets: [
['env', { modules: false }],
'stage-2',
'react',
],
plugins: [
'transform-react-constant-elements',
],
}

Expected Behavior

I think it should compile. Have I done anything wrong or is this a bug? Removing transform-react-constant-elements makes it work.

Current Behavior

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 = <SubscriberRoutes modules={modules} />, _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

Possible Solution

Context

I'm trying to build my app with Webpack.

Your Environment

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

software
version(s)

Babel
6.26.0

Webpack
4.1.1

node
9.7.1

yarn
1.5.1

Operating System
macOS 10.13.3

Issue 2:
Could the property descriptors passed to decorators be extended to hold type information, like they are for initializers?