entry
The entry point for the bundle.
If you pass a string: The string is resolved to a module which is loaded upon startup.
If you pass an array: All modules are loaded upon startup. The last one is exported.
entry:['./entry1','./entry2']
`</pre>
If you pass an object: Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array
<pre>`{
entry:{
page1: './pages1',
page2: ['./entry1','./entry2']
},
output: {
// Make sure to use [name] or [id] in output.filename
// when using multiple entry points
filename: '[name].bundle.js',
chunkFilename: '[id].bundle.js'
}
}
`</pre>
### Output
`output` options tell webpack how to write the compiled files to disk.
Note, that while there can be multiple 'entry' points, only 'output' configuration is specified.
If you use hashing(`[hash]` or `[chunkhash]`) make sure to have a consistent ordering of modules. Use the `OccurenceOrderPlugin` or `recordsPath`
#### output.filename
Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, `filename` is used solely for naming the individual files.
##### single entry
<pre>`{
entry: './src/app.js',
output: {
filename: 'bundle.js',
path: './build'
}
}
`</pre>
##### multiple entries
If you configuration creates more than a single "chunk"(as with multiple entry points or when using plugins like CommonsChunkPlugin), you should use substitutions below to ensure that each file has a unique name.
`[name]` is replaced by the name of the chunk
`[hash]` is replaced by the hash of the compilation.
`[chunkhash]` is replaced by the hash of the chunk.
<pre>`{
entry:{
app: './src/app.js',
search: './src/search.js'
},
output:{
filename: [name].js,
path: __dirname + '/built'
}
}
output.path
The output directory as absolute path(required).
Module.loaders
An array of automatically applied loaders.
Each item can have there properties:
test
: A condition that must be metexclude
: A condition that must not be metinclude
: A condition that must be metloader
: A string of ‘!’ separated loaders- ‘loaders’: An array of loaders as string