2016-03-15 30 views
2

我一直在關注本教程以設置開發反應js的環境。localhost:8080顯示反應js中的空白頁

React - tutorial

但是當我本地主機上運行:在瀏覽器8080,它顯示一個空白頁。 我試過所有的瀏覽器,但都沒有工作。

我已經安裝的WebPack,但是當我運行的WebPack命令,它說輸出文件名沒有配置

我的WebPack-config.js文件

module.exports = { 
    entry: './main.js', 

    output: { 
     path:'asd/', 
     filename: 'index.js', 
    }, 

    devServer: { 
     inline: true, 
     port: 8080 
    }, 

    module: { 
     loaders: [ { 
     test: /\.js?$/, 
     exclude: /node_modules/, 
     loader: 'babel', 

     query: { 
      presets: ['es2015', 'react'] 
     } 
     }] 
    } 

} 

module.exports = config; 

而且,他們在HTML教程中添加了一個腳本index.js,瀏覽器無法找到並顯示錯誤

404:服務器無法找到資源index.js

我開始從那裏我的文件夾conatining所有文件位於 請幫相同的路徑服務器。

回答

0

當你運行webpack時,它會在asd文件夾中查找文件index.js文件。請檢查你的文件夾結構以確認在asd文件夾中有一個名爲indexjs的文件。