Next: , Previous: , Up: Webpack Concepts   [Index]


3.3.2.2 Entry

An entry point indicates which module webpack should use to begin building out its internal dependency graph. webpack will figure out which other modules and libraries that entry point depends on (directly and indirectly).

By default its value is ./src/index.js, but you can specify a different (or multiple entry points) by setting an ‘entry’ property in the webpack configuration.

// shorthand
module.exports = {
  entry: './path/to/my/entry/file.js'
};

// object
module.exports = {
  entry: {
    main: './path/to/my/entry/file.js'
  }
};

// scalable object
module.exports = {
  entry: {
    app: './src/app.js',
    adminApp: './src/adminApp.js'
  }
};

// multi-main entry
module.exports = {
  entry: [ 
    './src/file_1.js',
    './src/file_2.js'
  ],
  output: {
    filename: 'bundle.js'
  }
};