2016-08-10 08:15:44 +03:00
|
|
|
require('es6-promise').polyfill();
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
|
|
|
var autoprefixer = require('autoprefixer');
|
|
|
|
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
|
|
|
|
|
var plugins = [
|
|
|
|
new webpack.NoErrorsPlugin(),
|
|
|
|
new webpack.optimize.DedupePlugin(),
|
|
|
|
];
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
plugins = plugins.concat([
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
output: {comments: false},
|
|
|
|
test: /bundle\.js?$/
|
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {NODE_ENV: JSON.stringify('production')}
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
2016-09-06 00:58:49 +03:00
|
|
|
var repo = __dirname
|
2016-08-10 18:31:27 +03:00
|
|
|
|
2016-08-10 08:15:44 +03:00
|
|
|
var config = {
|
|
|
|
entry: {
|
2016-09-07 03:04:02 +03:00
|
|
|
bundle: path.join(repo, 'frontend/index.jsx')
|
2016-08-10 08:15:44 +03:00
|
|
|
},
|
|
|
|
output: {
|
2016-09-13 22:50:37 +03:00
|
|
|
path: path.join(repo, 'assets/'),
|
2016-08-10 08:15:44 +03:00
|
|
|
publicPath: "/assets/",
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
|
|
|
plugins: plugins,
|
|
|
|
module: {
|
|
|
|
loaders: [
|
2016-09-08 15:50:44 +03:00
|
|
|
{test: /\.(png|gif)$/, loader: 'url-loader?name=[name]@[hash].[ext]&limit=6000'},
|
|
|
|
{test: /\.(pdf|ico|jpg|svg|eot|otf|woff|ttf|mp4|webm)$/, loader: 'file-loader?name=[name]@[hash].[ext]'},
|
2016-08-10 08:15:44 +03:00
|
|
|
{test: /\.json$/, loader: 'json-loader'},
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
2016-08-10 18:31:27 +03:00
|
|
|
include: path.join(repo, 'frontend'),
|
2016-08-10 08:15:44 +03:00
|
|
|
loaders: ['babel']
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
2016-09-07 23:07:45 +03:00
|
|
|
extensions: ['', '.js', '.jsx'],
|
2016-08-10 08:15:44 +03:00
|
|
|
alias: {
|
2016-08-10 18:31:27 +03:00
|
|
|
'#app': path.join(repo, 'frontend'),
|
2016-08-12 22:20:29 +03:00
|
|
|
'#components': path.join(repo, 'frontend/components'),
|
2016-08-10 08:15:44 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
svgo1: {
|
|
|
|
multipass: true,
|
|
|
|
plugins: [
|
|
|
|
// by default enabled
|
|
|
|
{mergePaths: false},
|
|
|
|
{convertTransform: false},
|
|
|
|
{convertShapeToPath: false},
|
|
|
|
{cleanupIDs: false},
|
|
|
|
{collapseGroups: false},
|
|
|
|
{transformsWithOnePath: false},
|
|
|
|
{cleanupNumericValues: false},
|
|
|
|
{convertPathData: false},
|
|
|
|
{moveGroupAttrsToElems: false},
|
|
|
|
// by default disabled
|
|
|
|
{removeTitle: true},
|
|
|
|
{removeDesc: true}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = config;
|