Entry
The entry configuration determines which module(s) webpack should use to begin building the dependency graph.The entry point(s) for the application.
Single Entry (String)
Simplest form - a single entry point:webpack.config.js
Multiple Modules (Array)
Combine multiple modules into a single chunk:webpack.config.js
Multiple Entry Points (Object)
Create separate bundles for different entry points:webpack.config.js
Entry Descriptor
Use objects to configure entry points with additional options:webpack.config.js
Entry Descriptor Options
Module(s) loaded on startup. The last one is exported.
Specifies the name of each output file for this entry.
Entry points that must be loaded before this entry.
Name of the runtime chunk. Creates a new runtime chunk or uses an existing entry as runtime.Set to
false to avoid a new runtime chunk.Method of loading chunks for this entry point.Options:
'jsonp', 'import', 'require', 'async-node', 'import-scripts', falseEnable/disable creating async chunks that are loaded on demand.Default:
trueMethod of loading WebAssembly modules.
Public path for this entry’s assets when referenced in a browser.
Base URI for this entry.
Layer in which modules of this entry point are placed.
Options for building this entry as a library. See Library Output for details.
Dynamic Entry
Define entry points dynamically using a function:webpack.config.js
webpack.config.js
webpack.config.js
Context
The base directory (absolute path) for resolving entry points and loaders.Default:
process.cwd() (current working directory)Must be an absolute path. Use
path.resolve() to ensure this.Common Patterns
Single Page Application
webpack.config.js
Multi-Page Application
webpack.config.js
Vendor Code Splitting
webpack.config.js
Code Splitting with Shared Dependencies
webpack.config.js
Separate Runtime Chunk
webpack.config.js