我已經工作了,記不起我改變了什麼,現在頁面加載了,但是沒有反應被渲染到屏幕上。不知道錯誤在哪裏。當我運行沒有出現錯誤的WebPack -m其次NPM開始React在Webpack開發服務器上不渲染
WebApp文件夾是這樣的...
- {}應用 - App.js
- {}公衆 - 束.js文件 - index.html的
- webpack.config.js
- .babelrc
- 的package.json
這裏有重要的文件
的WebPack
module.exports = {
entry: './app/App.js',
output: {
path: './public',
filename: 'bundle.js',
},
devServer: {
inline:true,
contentBase: './public',
port: 3333
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
}
}
的package.json
{
"name": "newaccount",
"version": "1.0.0",
"description": "a form submission for new accounts",
"main": "App.js",
"scripts": {
"start": "webpack-dev-server"
},
"author": "---",
"license": "ISC",
"dependencies": {
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-router": "^3.0.0"
},
"devDependencies": {
"babel-core": "^6.18.2",
"babel-loader": "^6.2.8",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"html-webpack-plugin": "^2.24.1",
"webpack": "^1.13.3",
"webpack-dev-server": "^1.16.2"
}
}
.babelrc
{
"presets": [
"es2015",
"react"
]
}
App.js
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
class Testing extends Component {
render() {
return (
<div>
<h3>JUST A TEST</h3>
</div>
)
}
}
ReactDOM.render(<Testing />, document.getElementById('app'));
我曾經試圖使組件測試的ES6常量像...
const Testing =() => return <div><h3>JUST A TEST</h3></div>
,但仍無法得到任何顯示在本地主機:3333或從我的計算機的完整路徑。
感謝所有幫助
瀏覽器控制檯沒有錯誤? – azium