我正在使用node,express做出反应应用程序。但突然间我得到了这个错误“Uncaught SytaxError:Unexpected Token:”
在这一行打破:
/***/ function(module, exports) {
module.exports =
C:\Users\Dimotro\Desktop\queffect\node_modules\webpack-dev-server\client\index.js?http://localhost:3333;
/***/ },
这是我在浏览器控制台中可以看到的。 React-dev-tools完美编译,没有错误。
任何帮助表示赞赏!谢谢!
编辑:请求的文件
App.js:
import React from 'react';
import ReactDOM from 'react-dom';
import express from 'express';
import cors from 'cors';
var app = express();
var json = require('body-parser').json;
import GET_QUEST_DATA from './assets/constants';
class Header extends React.Component{
render(){
return (
<div id="header">
<div className="header-box">
<ul className="menu">
<li className="menu-item"><a href="#">About</a></li>
<li className="menu-item"><a href="#">Queffect</a></li>
<li className="menu-item"><a href="#">Sup4port</a></li>
</ul>
</div>
</div>
);
}
}
class Content extends React.Component{
render(){
return (
<div id="content">
<div className="content-box">
<Calculator />
</div>
</div>
);
}
}
const Calculator = (props) => {
return(
<div className="calculator-container">
<h1 className="calculator title">Queffect</h1>
<bold>is a calculator that get's your quest requirements done, effectively.</bold>
<div className="character col-sm-4">
I'm <input className="username" type="text" placeholder="Username"/> and my objective is a
<select>
<option>Quest</option>
<option>Skill</option>
</select>
<select>
<option>Attack</option>
<option>Strenght</option>
<option>Defence</option>
<option>Ranged</option>
<option>Prayer</option>
<option>Magic</option>
<option>Constitution</option>
<option>Crafting</option>
<option>Mining</option>
<option>Smithing</option>
<option>Fishing</option>
<option>Cooking</option>
<option>Firemaking</option>
<option>Woodcutting</option>
<option>Runecrafting</option>
<option>Dungeoneering</option>
<option>Agility</option>
<option>Herblore</option>
<option>Thieving</option>
<option>Fletching</option>
<option>Slayer</option>
<option>Farming</option>
<option>Construction</option>
<option>Hunter</option>
<option>Summoning</option>
<option>Deviation</option>
<option>Invention</option>
</select>
<button className="update">Guide me</button>
</div>
<div className="path col-sm-8">
{console.log(GET_QUEST_DATA("Gixy"))}
</div>
</div>
);
}
ReactDOM.render(
<div>
<Header />
<Content />
</div>,
document.getElementById('app')
);
export default {};
webpack.config.js:
module.exports = {
entry: './index.js',
target: 'node',
output: {
path: './',
filename: 'index.js',
},
devServer: {
inline: true,
port: 3333
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
],
noParse: ['ws']
},
externals: [/^(?!\.|\/).+/i, 'ws']
}