私の問題は、何をしても で 404 が表示され、wepack_hmr
それが利用できない理由を一生理解できないことです。
完全な Webpack 構成
var url = 'http://localhost:3000';
module.exports = {
resolve: {
extensions: ['', '.js']
},
entry: ['webpack-hot-middleware/client','./src/client/js/Kindred'],
devtool: 'cheap-module-source-map',
module: {
loaders:[
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {presets: ['es2015', 'react', 'react-hmre', 'stage-0']}
},
{test: /\.png$/, loader: "url-loader?limit=100000"},
// Images
{test: /\.jpg$/, loader: "file-loader"},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file?name=./font/[name].[ext]'
},
// Stylesheets
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style',
[
'css?sourceMap&modules&importLoaders=1',
'sass?sourceMap&modules',
]
) },
// Font Definitions
{ test: /\.svg$/, loader: 'url?limit=65000&mimetype=image/svg+xml&name=public/font/[name].[ext]' },
{ test: /\.woff$/, loader: 'url?limit=65000&mimetype=application/font-woff&name=public/font/[name].[ext]' },
{ test: /\.woff2$/, loader: 'url?limit=65000&mimetype=application/font-woff2&name=public/font/[name].[ext]' },
{ test: /\.[ot]tf$/, loader: 'url?limit=65000&mimetype=application/octet-stream&name=public/font/[name].[ext]' },
{ test: /\.eot$/, loader: 'url?limit=65000&mimetype=application/vnd.ms-fontobject&name=public/font/[name].[ext]' }
]
},
sassLoader: {
includePaths: [ 'src/client/scss' ]
},
plugins: process.env.NODE_ENV === 'production' ? [
new ExtractTextPlugin ('app.css', {allChunks: true}),
new webpack.optimize.DedupePlugin (),
new webpack.optimize.OccurrenceOrderPlugin (),
new webpack.optimize.UglifyJsPlugin ()
] : [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin("style.css")
],
devServer: {
hot: true,
contentBase: './public'
},
output: {
path: path.join(__dirname),
publicPath: '/',
filename: 'bundle.js'
}
};
実行するノード コマンド
webpack-dev-server --inline --history-api-fallback --port 3000
ページを読み込むとき
[HMR] Waiting for update signal from WDS...
home:1 GET http://localhost:3000/__webpack_hmr
client:22 [WDS] Hot Module Replacement enabled.
実行には時間がかかりますが、そうではありません:/