私はちょうど反応を開始し、codecademy
コースと他のいくつかの他のyoutubeで終了しました。私は反応のために私のローカルマシンを構成することにしました。私はwebpack & webpack-dev-serverから始めました。そしてここで私は間違いをする。ここで Here is mistake screenshotウェブパックは反応しません。
私webpack.config.jsです:
var webpack = require('webpack');
var path = require('path');
module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack-dev-server/client?http://127.0.0.1:8080/',
'webpack/hot/only-dev-server',
'./src'
],
output: {
path: path.join(__dirname, 'public'),
filename: "bundle.js"
},
resolve: {
modulesDirectories: ['node_modules', 'src'],
extensions: ['', '.js']
},
module: {
loader: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel?presets[]=react,presets[]=es2015']
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
私のindex.html:
<!DOCTYPE html>
<html>
<head>
<title>React ToDos App</title>
</head>
<body>
<div id="app" />
<script src="bundle.js"></script>
</body>
</html>
そしてindex.js:
let message = 'Hello from entry message';
console.log(message);
何か助けていただきありがとうございます。
である必要があり、あなたのスクリーンショットで
どういう意味ですか?私はまだそれほど進歩的ではありません。 –
[Expressで静的ファイルを提供する](https://expressjs.com/en/starter/static-files.html)、パブリックフォルダへの出力を指定する必要もあります。 –