Skip to main content

What is output in webpack?

output in Webpack is a setting that determines where and under what name Webpack outputs the final built files (bundles).

In other words, if entry is where to start the build, then output is where to put the result.

Configuration example:

js
module.exports = { entry: './src/index.js', output: { filename: 'bundle.js', // name of the final bundle path: path.resolve(__dirname, 'dist') // output folder } }

Here Webpack will build the project and place the result at:

javascript
/dist/bundle.js

Briefly:

  • filename - the name of the resulting file, or the naming pattern for multiple bundles
  • path - the absolute path to the directory where the build is saved

output is responsible for the structure, path, and name of the files that Webpack creates after the build.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.