How to set multiple file entry/output in project with webpack?
I follow http://webpack.github.io/docs/tutorials/getting-started/ success compile if only one file in
For many entry points use arrays as a value of entry
property:
entry: {
app: ['./app/main.js', '.lib/index.js'],
vendors: ['react']
}
app
and vendors
are arrays, so you can put there as many file paths as you need.
For output case:
output: {
path: staticPath,
filename: '[name].js'
}
The [name]
is taken from entry
properties, so if we have app
and vendors
as properties, we got 2 output files - app.js
and vendors.js
.
Documentation link