hh54188
hh54188

Reputation: 15626

webpack doesn't output bundle file

Here is my folder structure:

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

And here is my part of my webpack.config.js file content:

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

When I run the webpack, no file output in the output folder. However, the terminal show no error, also the app.bundle.js seems already been ouputed.

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.

So what's wrong with my code ?

Upvotes: 0

Views: 743

Answers (1)

Michael Jungo
Michael Jungo

Reputation: 32972

It looks like you're running webpack-dev-server, which compiles your bundle but does not write it to disk (it keeps it in memory).

You have to run webpack to get the output files.

webpack --config config/webpack.config.js

Upvotes: 1

Related Questions