Skip to content

Instantly share code, notes, and snippets.

@shhetri
Forked from laracasts/webpack.config.js
Created January 3, 2017 04:22
Show Gist options
  • Save shhetri/44d400a5ffde9e7b998e32c77c873661 to your computer and use it in GitHub Desktop.
Save shhetri/44d400a5ffde9e7b998e32c77c873661 to your computer and use it in GitHub Desktop.
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {
path: path.resolve(__dirname, 'public/js'),
filename: '[name].js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.js'
}
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor']
})
]
};
if (process.env.NODE_ENV === 'production') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourcemap: true,
compress: {
warnings: false
}
})
);
module.exports.plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment