1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-15 06:32:34 +01:00
flox/client/webpack.config.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

2016-10-10 10:57:39 +02:00
const webpack = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
const lost = require('lost');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
app: './app/app.js',
vendor: ['vue', 'vue-resource', 'vuex']
},
output: {
path: path.resolve('../public/assets'),
filename: 'app.js'
},
resolve: {
alias: {
vue: 'vue/dist/vue.js'
}
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(png|jpg|svg)$/,
loader: 'url',
query: {
limit: 10000,
name: 'img/[name].[ext]',
emitFile: false
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss!sass')
}
]
},
postcss() {
return [autoprefixer, lost];
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
new ExtractTextPlugin('app.css')
]
};
if(process.env.NODE_ENV === 'production') {
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
])
}