2017-06-12 106 views
0

這裏是我的文件夾結構:的WebPack不輸出捆綁文件

config 
|--webpack.config.js 
entry 
|--app.js 
output 

這裏是我的我的webpack.config.js文件的部分內容:

module.exports = { 
    context: path.join(__dirname, '..'), 
    entry: { 
     app: './entry/app.js' 
    }, 
    output: { 
     path: path.resolve('.', 'output'), 
     filename: '[name].bundle.js' 
    }, 

當我運行的WebPack,沒有文件輸出在output文件夾中。但是,終端顯示沒有錯誤,app.bundle.js似乎已經被輸出。

Hash: 0d0e4e77f57e49724b60 
Version: webpack 2.6.1 
Time: 22416ms 
     Asset Size Chunks     Chunk Names 
app.bundle.js 389 kB  0 [emitted] [big] app 
chunk {0} app.bundle.js (app) 1.1 MB [entry] [rendered] 
    [26] ./~/react/lib/React.js 3.34 kB {0} [built] 
    [100] ./~/react/react.js 55 bytes {0} [built] 
    [116] ./entry/app.js 465 bytes {0} [built] 
    [117] (webpack)-dev-server/client?http://localhost:8080 5.64 kB {0} [built] 
    [124] ./~/events/events.js 8.45 kB {0} [built] 
    [151] ./~/react-dom/index.js 58 bytes {0} [built] 
    [262] ./~/strip-ansi/index.js 161 bytes {0} [built] 
    [265] ./~/url/url.js 23.1 kB {0} [built] 
    [267] (webpack)-dev-server/client/overlay.js 3.61 kB {0} [built] 
    [268] (webpack)-dev-server/client/socket.js 872 bytes {0} [built] 
    [269] (webpack)/hot/emitter.js 89 bytes {0} [built] 
    [270] ./src/scripts/module_b_es6.js 128 bytes {0} [built] 
    [271] ./src/scripts/react_components/head.jsx 2.32 kB {0} [built] 
    [274] ./src/styles/style.css 911 bytes {0} [built] 
    [275] multi (webpack)-dev-server/client?http://localhost:8080 ./entry/app.js 
0 bytes {0} [built] 
    + 261 hidden modules 
webpack: Compiled successfully. 

那麼,我的代碼有什麼問題?

回答

0

它看起來像你正在運行webpack-dev-server,它編譯你的包,但不寫入磁盤(它保存在內存中)。

您必須運行webpack才能獲取輸出文件。

webpack --config config/webpack.config.js