【发布时间】:2017-04-20 13:24:10
【问题描述】:
我有这个工作,不记得我改变了什么,现在页面加载但没有反应呈现到屏幕上。不确定错误在哪里。当我运行 webpack -m 后跟 npm start 时没有发生错误
webapp 文件夹是这样的...
- {应用} -- App.js
- {公共} -- 捆绑.js -- index.html
- webpack.config.js
- .babelrc
- package.json
这里是重要文件
网络包
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 之类的......
const Testing = () => return <div><h3>JUST A TEST</h3></div>
仍然无法在 localhost:3333 或我的计算机的完整路径上显示任何内容。
感谢您的帮助
【问题讨论】:
-
浏览器控制台没有错误?
-
nope 控制台中没有错误 :(