what does webpack do code example

Example: what is webpack.js

// Based on the provided configuration (webpack.config.js), 
// webpack starts from the entry points and resolves each module it 
// encounters while constructing the dependency graph

// entry points
// the entry point is the module that webpack uses to start building its internal dependency graph.
entry: {
            'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
        },
          
          
// output point
// the output property instructs webpack where to emit the bundle(s) and what name to use for the file(s)
output: {
            filename: '[name].js',
            path: path.resolve(__dirname, '../priv/static/js'),
            publicPath: '/js/'
        },
          
// dependency graph
// From the entry point, webpack will configure a set of nodes connected to one 
// another as dependencies and will compile that to the output point