2016-07-26 9 views
0

私は反応を使用してプログレッシブウェブアプリケーションを構築しています。Webpack-dev-serverは、アプリケーションページの代わりにディレクトリリストを表示します

enter image description here

私のWebアプリケーションの設定:私は私の索引を参照してくださいすることはできませんよと

enter image description here

はこれで私を助けてください:これは私のディレクトリ構造は

var webpack = require('webpack'); 
var path = require('path'); 

module.exports = { 
    entry: [ 
     'webpack-dev-server/client?http://127.0.0.1:8080', 
     'webpack/hot/only-dev-server', 
     './src/index.jsx' 
    ], 
    output: { 
     path: path.join(__dirname,'public'), 
     filename: 'bundle.js', 
     publicPath: 'http://localhost:8080' 
    }, 
    devServer: { 
     contentBase: "./public", 
     hot: true 
    }, 
    resolve: { 
     modulesDirectories: ['node_modules','src'], 
     extensions: ['','.js'] 
    }, 
    module: { 
     loaders: [ 
      { 
       test: /\.jsx?$/, 
       exclude: /node_modules/, 
       loaders: ['react-hot','babel?presets[]=react,presets[]=react,presets[]=es2015'] 
      } 

     ] 
    }, 
    plugins:[ 
     new webpack.HotModuleReplacementPlugin(), 
     new webpack.NoErrorsPlugin() 
    ] 
}; 

です.html。 は私の設定に何かファイルがあり

答えて

1

あなた"src" ので、あなたのwebpack.config.jsはこのようにすべきindex.htmlは、フォルダ内にある:

devServer: { 
    contentBase: "./src", 
    hot: true 
}, 
関連する問題