尝试从Hypernova-php渲染React时出现奇怪的语法错误

时间:2018-02-11 21:40:10

标签: javascript php reactjs babeljs

我在使用Wayfair的Hypernova php客户端尝试渲染React组件时,收到的以下堆栈跟踪不是很有用。

  0 => string 'SyntaxError: Unexpected token ...' (length=33)
  1 => string 'at exports.runInThisContext (vm.js:53:16)' (length=41)
  2 => string 'at Module._compile (module.js:373:25)' (length=37)
  3 => string 'at Module._extensions..js (module.js:416:10)' (length=44)
  4 => string 'at Object.require.extensions.(anonymous function) [as .js] (/Users/lucasreisch/Documents/brokerfirst/brokerfirst_resources/node_modules/babel-core/node_modules/babel-register/lib/node.js:152:7)' (length=193)
  5 => string 'at Module.load (module.js:343:32)' (length=33)
  6 => string 'at Function.Module._load (module.js:300:12)' (length=43)
  7 => string 'at Module.require (module.js:353:17)' (length=36)
  8 => string 'at require (internal/module.js:12:17)' (length=37)
  9 => string 'at Object.<anonymous> (/Users/lucasreisch/Documents/brokerfirst/brokerfirst_resources/node_modules/babel-plugin-react-css-modules/src/index.js:14:1)' (length=148)
  10 => string 'at Module._compile (module.js:409:26)' (length=37)
  11 => string 'at Module._extensions..js (module.js:416:10)' (length=44)
  12 => string 'at Object.require.extensions.(anonymous function) [as .js] (/Users/lucasreisch/Documents/brokerfirst/brokerfirst_resources/node_modules/babel-core/node_modules/babel-register/lib/node.js:152:7)' (length=193)
  13 => string 'at Module.load (module.js:343:32)' (length=33)
  14 => string 'at Function.Module._load (module.js:300:12)' (length=43)
  15 => string 'at Module.require (module.js:353:17)' (length=36)
  16 => string 'at require (internal/module.js:12:17)' (length=37)

我正在渲染的组件只是一个扩展React.component

的准系统反应组件
import React from 'react';
import {renderReact} from 'hypernova-react';

class TestSSR extends React.Component {
    render() {
        return (
            <div></div>
        );
    }
}

export default TestSSR

我认为这是一个巴别塔问题。我的.babelrc文件如下

{
   "presets": ["env", "react"],
   "plugins": [
    "transform-class-properties",
    "react-css-modules",
    "transform-object-rest-spread"
  ]
}

如果你见过这样的话,请告诉我!!

0 个答案:

没有答案