I created a simple webpack.config.js
var path = require("path");
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
module.exports = {
context: path.join(__dirname, "resources/assets"),
entry: {
login: "./js/login.js",
post: "./js/post.js",
common: "./js/common.js"
},
output: {
path: path.join(__dirname, "public/js"),
filename: "[name].js"
},
plugins: [
new CommonsChunkPlugin({
filename: "common.js",
name: "common"
})
]
};
but what is the correct way to make Elixir use it?
Looks like it still needs a file path, that is mix.webpack() throws error.
mix.webpack('') seems to work but looks weird, not sure if it is the correct way.
UPD: also it fails during production build
Starting 'webpack'...
Hmm, not sure how to compress this type of file. Stick with CSS or JavaScript files!
mix.webpack(['post.js', 'login.js', 'common.js']) and mix.webpack('*.js') seem to work but looks like it was not intended to be used like this because destination output looks weird: public\js\all.js (though all.js is not created)