私は簡単な反応プロジェクトを設定しました。私はここでReactJS:webpack Bundle.js not found(404)
`{
"name": "hello-react",
"version": "1.0.0",
"description": "simple react app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"express": "^4.13.4",
"react": "^0.14.7",
"react-dom": "^0.14.7"
},
"devDependencies": {
"babel-core": "^6.5.1",
"babel-loader": "^6.2.2",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"webpack": "^1.12.13"
}
}`
がserver.jsである私のpackage.jsonファイルIは、エラーがhttp://localhost:3001/bundle.js 404(見つかりません)しかし、ここで
パブリックフォルダに生成されbundle.js GET geting午前、WebPACKのをされて使用しています
var express = require('express');
// Create our app
var app = express();
app.use(express.static('public'));
app.listen(3001,function(){
console.log('server is up on 3001');
});
index.htmlを
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
</html>
はい、しかし、公開/ドットのあなたは( '')代わりにカンマを使用し、ホームディレクトリ –
です( '.') –
おかげで、Rishabh、それはカンマではなかったが、 –