ReactJS: “Uncaught SyntaxError: Unexpected token <”

前端 未结 9 1614
天命终不由人
天命终不由人 2020-11-27 02:45

I am trying to get started building a site in ReactJS. However, when I tried to put my JS in a separate file, I started getting this error: \"Uncaught SyntaxError: Unexpecte

9条回答
  •  离开以前
    2020-11-27 03:44

    Try adding in webpack, it solved the similar issue in my project. Specially the "presets" part.

    module: {
        loaders: [
            {
                test: /\.jsx?/,
                include: APP_DIR,
                loader: 'babel',
                query  :{
                    presets:['react','es2015']
                }
            },
    

提交回复
热议问题