2017-05-24 3 views
1

Um ein Elektron & reagieren Anwendung zu erstellen, war ich mit der Reaktion und node7 präsentiert wie folgt (die funktioniert)babel voreingestellt-env mit elektronen & reagieren

"babel": { 
    "sourceMaps": "inline", 
    "presets": [ 
     "react", 
     "node7" 
    ] 
    }, 

Aber ich wollte Beweis mit etwas mehr Zukunft gehen, so Ich habe das Preset-env ausprobiert

"babel": { 
    "sourceMaps": "inline", 
    "presets": [ 
     [ 
     "env", 
     { 
      "targets": { 
      "electron": "1.6.7" 
      }, 
      "debug": true, 
      "useBuiltIns": true 
     } 
     ] 
    ] 
    }, 

Allerdings funktioniert das nicht für mich. Es scheint, dass ES7-Objekt Verbreitung nicht gefunden wird, und es gibt Probleme mit reagieren JSX. Was für eine einfache Sache habe ich vermisst?

babel-preset-env: `DEBUG` option 

Using targets: 
{ 
    "electron": "1.6.7" 
} 

Modules transform: commonjs 

Using plugins: 
    syntax-trailing-function-commas {"electron":"1.6.7"} 

Using polyfills: 
    es7.string.pad-start {"electron":"1.6.7"} 
    es7.string.pad-end {"electron":"1.6.7"} 
    web.timers {"electron":"1.6.7"} 
    web.immediate {"electron":"1.6.7"} 
    web.dom.iterable {"electron":"1.6.7"} 
src\dash\actions.js -> dist\dash\actions.js 
src\dash\actionTypes.js -> dist\dash\actionTypes.js 
SyntaxError: src/dash/dash.js: Unexpected token (29:18) 
    27 |  let stats = remote.getGlobal('DASH').stats 
    28 |  //stats.jobStats = (stats.jobStats == "") ? "0" : stats.jobStats -- we only needed this if the folder was m 
issing 
> 29 |  let state = { ...STORE.getState().ServerStats } 
    |     ^
    30 |  let original = { ...state } 
    31 |  state.WatsonInstalled = (state.WatsonInstalled != stats.watsonInstalled) ? stats.watsonInstalled : state.Wat 
sonInstalled 
    32 |  state.WatsonRunning = (state.WatsonRunning != stats.watsonRunning) ? stats.watsonRunning : state.WatsonRunni 
ng 
SyntaxError: src/dash/reducers.js: Unexpected token (18:25) 
    16 |  switch (action.type) { 
    17 |   case A.SetUpdating: 
> 18 |    newState = { ...state, isUpdating: action.payload } 
    |      ^
    19 |    return newState 
    20 |   case A.SetChanger: 
    21 |    newState = { ...state, fieldName: action.payload } 
SyntaxError: src/jsx/Configuration.jsx: Unexpected token (19:4) 
    17 |  resetForm, 
    18 |  isUpdating, 
> 19 |  ...props }) => { 
    | ^
    20 |  COMPONENTS["Configuration"] = props // Register this component in the Dash Components list (so we can get th 
e change() function) 
    21 |  return (
    22 |   <Form horizontal onSubmit={(e) => { alert('foobar'); handleSubmit(doSubmit) }}> 
SyntaxError: src/jsx/Controls.jsx: Unexpected token (7:8) 
    5 | const Control = ({ WatsonInstalled, WatsonRunning, FMERunning, buttonAction }) => { 
    6 |  return (
> 7 |   <Grid> 
    |  ^
    8 |    <Row className="propRow"> 
    9 |     <Col sm={3}> 
    10 |      <OverlayTrigger placement="bottom" 
SyntaxError: src/jsx/Dashboard.jsx: Unexpected token (12:4) 
    10 | const App = ({ GLVersion }) => { 
    11 | return (
> 12 |  <Grid> 
|  ^
    8 |    <Row className="propRow"> 
    9 |     <Col sm={3}> 
    10 |      <OverlayTrigger placement="bottom" 
SyntaxError: src/jsx/Dashboard.jsx: Unexpected token (12:4) 
    10 | const App = ({ GLVersion }) => { 
    11 | return (
> 12 |  <Grid> 
    | ^
    13 |  <Row className="versionRow"> 
    14 |   <Col smOffset={10} sm={1} className="fieldLabel">Version:</Col> 
    15 |   <Col sm={1} className="fieldLabel">{GLVersion}</Col> 
SyntaxError: src/jsx/FieldInputs.jsx: Unexpected token (9:8) 
    7 | const FieldControl = ({ input, meta, type, min, max, tip, cid }) => { 
    8 |  return (
> 9 |   <OverlayTrigger placement="left" overlay={(<Tooltip id={cid + "-tip"}>{tip}</Tooltip>)}> 
    |  ^
    10 |    <FormControl 
    11 |     type={type} 
    12 |     min={min} 
SyntaxError: src/jsx/Utilities.jsx: Unexpected token (9:8) 
    7 | const Util = ({ JobsDirSize, killAction }) => { 
    8 |  return (
> 9 |   <Grid> 
    |  ^
    10 |    <Row className="propRow"> 
    11 |     <Col sm={3} className="fieldLabel">Job Folder Size:</Col> 
    12 |     <Col sm={9} className="fieldLabel">{JobsDirSize} MB</Col> 
src\main\main.js -> dist\main\main.js 
src\main\monitor.js -> dist\main\monitor.js 
src\main\utils.js -> dist\main\utils.js 
src\main\watson.js -> dist\main\watson.js 

Antwort

Verwandte Themen