4
반응이 빠르고 webpack입니다. 매번 나는이 문제를 해결할 수없는 프로그램을 실행합니다. 나는 이전의 질문을 거쳐 그들의 해결책을 시도했지만 여전히 문제는 동일하게 남아 있습니다.예기치 않은 토큰 가져 오기 - 반응
webpack
module.exports = {
entry: './src/App.js',
output: {
path: __dirname,
filename: 'app.js',
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'stage-0', 'react']
},
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
],
},
};
App.js
import React from 'react';
import ReactDOM from 'react-dom';
var CommentBox = React.createClass({
render: function() {
return (
<div className="CommentBox">
Hello, world!I am Comment Box.
</div>
);
}
});
ReactDOM.render(<CommentBox/>, document.getElementById('app'));
package.json
{
"name": "React-Examples",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Rakesh",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.14.0",
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.5.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"react": "^15.1.0",
"react-dom": "^15.1.0"
}}
'test :/\ .jsx? $ /'를'test :/.js? $ /'로 변경하면 어떨까요? – Gregg
여전히 동일합니다. –
오류 메시지에 대한 자세한 정보를 제공 할 수 있습니까? 스크린 샷이나 뭐? 그것은 줄 번호를 제공합니까? 그리고 당신의 코드는 모두 박스로 묶여 있습니다. 앱의 구조를 이해하는 것이 약간 어렵습니다. – Gregg