2016-09-01 3 views
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" 
}} 
+0

'test :/\ .jsx? $ /'를'test :/.js? $ /'로 변경하면 어떨까요? – Gregg

+0

여전히 동일합니다. –

+0

오류 메시지에 대한 자세한 정보를 제공 할 수 있습니까? 스크린 샷이나 뭐? 그것은 줄 번호를 제공합니까? 그리고 당신의 코드는 모두 박스로 묶여 있습니다. 앱의 구조를 이해하는 것이 약간 어렵습니다. – Gregg

답변

0

파일을 복사하여 설치해 보았습니다.

'npm install'은 종속성 만 설치하고 devDependencies를 설치하지 않습니다. 때로는 일어난다 ... 여기에있는 경우 일 수도있다.

당신은 바벨 - 사전 단계-0

npm install babel-preset-stage-0 --save-dev 

, 또한 당신이 하나 개의 패키지 누락

npm install --only=dev 

를 시도 할 다음 웹팩 다시 실행하려고?