babel watch SyntaxError: Unexpected token

前端 未结 3 1870
生来不讨喜
生来不讨喜 2020-12-21 03:56

When I uses babel to watch a jsx file. But there is a syntax error.

Before that, I uses react-tools to watch, and everything is fine.

SyntaxError: as         


        
3条回答
  •  死守一世寂寞
    2020-12-21 04:36

    command:

    babel --watch assets/js/ --out-dir dist/js/ --presets react
    

    or package.json:

    {
        "name": "myweb",
        "version": "1.0.0",
        "babel": {
            "presets": ["react"]
        }
    }
    

提交回复
热议问题