Config

Complete listing of options for the module.exports object in webpack.config.js.

Note: because webpack.config.js is valid JavaScript, you can perform the same operations on the module.exports object as you can any other JavaScript object, such as iteration and merging. Such operations are for advanced users, but may be useful when your application configuration is especially complex.

Option Accepts Default Description
context string __dirname Sets the root directory for entry. Helpful when using multiple entry points.
devServer object Settings for webpack-dev-server (saves you from having to specify flags)
devServer.contentBase string __dirname The directory to run the server from
entry string|array|object (Required) File path(s) for Webpack to parse, starting from the project root; object syntax is recommended: { app: './js/page1.js' }
module object More settings for Webpack
module.rules array Replaces module.loaders from v1.x (see Loaders)
output object (Required) Output options (continued below)
output.filename string|array (Required) Compiled file(s) for Webpack to output (e.g.: 'js/app.bundle.js')
output.library string Declare a public namespace for the bundle
output.libraryTarget string var Export the library in an alternate format than a var instance. Possible values: 'var'|'this'|'commonjs'|'commonjs2'|'amd'|'umd
output.path string __dirname Set this to change Webpack’s build directory
output.publicPath string __dirname Where Webpack should serve production assets from; useful for CDNs
plugins array [] (see Plugins)
resolve object Configure this if Webpack has trouble finding modules
resolve.extensions array extensions: ["", ".webpack.js", ".web.js", ".js"] If a module include is missing an extension, try to load the file using these extensions, in order*
resolve.modules array ["node_modules", "web_modules"] Array of module paths

results matching ""

    No results matching ""