2015-04-28 84 views
5

我終於找到了他開發的服務器,並且我在屏幕上找到了一些東西。 我設置了一個故宮 「開始」 這樣的腳本:Webpack:無法找到bundle.js

"start": "webpack-dev-server --content-base app" 

我得到一個錯誤:

http://localhost:8080/bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) 

我的文件夾設置如下:

appDir 
    ->app 
    ->node_modules 
    webpack.config.js 
    package.json 

我的WebPack .config.js:

module.exports = { 
    context: __dirname + '/app', 
    entry: './index.js', 
    output: { 
     path: __dirname + '/app', 
     filename: './bundle.js' 
    } 
} 

你能說出有什麼問題嗎?

回答

7

bundle.js位於/app目錄內。輸出中的path選項指定文件的絕對路徑。

此外,您不需要文件名中的./。它會解決相對於output.path,但它很混亂,並可能導致您的問題。

相關問題