如何修复“意外的令牌” @observer错误?

时间:2018-12-02 14:00:00

标签: reactjs electron mobx electron-forge

我试图将MobX集成到我的Electron + React.js项目中,并添加了带有@observer批注的组件,就像在文档中一样:

@observer
class TodoListView extends Component {

不幸的是,我得到了错误:

  

... / components / TodoListView.jsx:意外令牌(6:0)

这是我的package.json的样子:

{
  "name": "electron1",
  "productName": "electron1",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "eslint --cache --color --ext .jsx,.js src"
  },
  "keywords": [],
  "author": "steph",
  "license": "MIT",
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "yarn"
      },
      "electronWinstallerConfig": {
        "name": "electron1"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "electron1"
      }
    }
  },
  "dependencies": {
    "electron-compile": "^6.4.3",
    "electron-devtools-installer": "^2.1.0",
    "electron-squirrel-startup": "^1.0.0",
    "express": "^4.12.3",
    "mobx": "^5.6.0",
    "mobx-react": "^5.4.2",
    "react": "^15.4.1",
    "react-dom": "^15.4.1",
    "react-hot-loader": "^3.0.0-beta.6",
    "ws": "^0.7.1"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-plugin-transform-es2015-classes": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "^5.2.3",
    "electron-prebuilt-compile": "3.0.10",
    "eslint": "^3",
    "eslint-config-airbnb": "^15",
    "eslint-plugin-import": "^2",
    "eslint-plugin-jsx-a11y": "^5",
    "eslint-plugin-react": "^7"
  }
}

最初,我用电子伪造开始了这个项目。 我是一名反应灵敏的初学者,也没有太多js经验-非常感谢您提供任何帮助!

0 个答案:

没有答案