mirror of
https://github.com/devfake/flox.git
synced 2024-11-15 06:32:34 +01:00
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
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()
|
|
])
|
|
} |