-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I have the following code:
...
if(movementId) {
movementDetails = (<Dialog
...
<div className="row">
<div className="col-md-12">
<Temp origin={origin} destiny={destiny} actions={actions} map={map} google={google} />
</div>
</div>
...
}
....
And by some reason the row div gets declared outside de if scope, and so at runtime I get
3.96a4658….chunk.js:192 Uncaught (in promise) ReferenceError: origin is not defined
The code after transpilation looks something like this:
var _ref10 = _jsx('div', {
className: 'row'
}, void 0, _jsx('div', {
className: 'col-md-12'
}, void 0, _jsx(__WEBPACK_IMPORTED_MODULE_16__components_MapTemplate_index_js__["a" /* default */], {
origin: origin,
destiny: destiny,
actions: actions,
map: map,
google: google
})));
if (movementId) {
(function () {
var _jsx2;
var movement = env.Movement.findBy('id', movementId);
var origin = movement.origin();
var destiny = movement.destiny();
var transport = movement.transport();
var driver = transport.driver();
Please note how _ref10 is declared outside the if statement.
I don't understand why a new variable is created for this in first place (might it be because of the nesting?).
This doesn't happen while using webpack-dev-server.
I'm using webpack 2.1.0-beta.12 and react 15.3.2
Metadata
Metadata
Assignees
Labels
No labels