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
what really solved it for me was this:
entry: {
app : __dirname + "/app/views/app/app.js",
admin : __dirname + "/app/views/admin/admin.js"
}
output: {
path: __dirname + "/public",
filename: "[name].js"
},