2017-03-31 18:21:41 +00:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const webpackMerge = require('webpack-merge');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
|
|
|
|
const commonConfig = require('./common.js');
|
|
|
|
|
2017-06-20 05:14:04 +00:00
|
|
|
module.exports = function () {
|
2017-03-31 18:21:41 +00:00
|
|
|
return webpackMerge(commonConfig(), {
|
|
|
|
output: {
|
2017-06-20 05:14:04 +00:00
|
|
|
filename: '[name].js',
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
devtool: 'source-map',
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2017-06-20 05:14:04 +00:00
|
|
|
'NODE_ENV': JSON.stringify('production'),
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
}),
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
beautify: false,
|
|
|
|
mangle: {
|
|
|
|
screw_ie8: true,
|
2017-06-20 05:14:04 +00:00
|
|
|
keep_fnames: true,
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
compress: {
|
|
|
|
screw_ie8: true,
|
2017-06-20 05:14:04 +00:00
|
|
|
warnings: false,
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2017-06-20 05:14:04 +00:00
|
|
|
comments: false,
|
2017-03-31 18:21:41 +00:00
|
|
|
}),
|
|
|
|
new ExtractTextPlugin('[name].css'),
|
|
|
|
new ManifestPlugin({
|
|
|
|
fileName: 'manifest.json',
|
2017-06-20 05:14:04 +00:00
|
|
|
}),
|
2017-03-31 18:21:41 +00:00
|
|
|
],
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /(node_modules)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2017-06-20 05:14:04 +00:00
|
|
|
presets: ['env'],
|
|
|
|
},
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(s)?css$/,
|
|
|
|
use: ExtractTextPlugin.extract({
|
|
|
|
fallback: 'style-loader',
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
importLoaders: 1,
|
|
|
|
minimize: {
|
|
|
|
discardComments: {
|
2017-06-20 05:14:04 +00:00
|
|
|
removeAll: true,
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
core: true,
|
2017-06-20 05:14:04 +00:00
|
|
|
minifyFontValues: true,
|
|
|
|
},
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
'postcss-loader',
|
2017-06-20 05:14:04 +00:00
|
|
|
'sass-loader',
|
|
|
|
],
|
|
|
|
}),
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
|
|
|
{
|
2017-10-15 21:57:35 +00:00
|
|
|
test: /\.(jpg|png|gif|svg|ico)$/,
|
|
|
|
include: /node_modules/,
|
2017-03-31 18:21:41 +00:00
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'img/[name].[ext]',
|
2017-06-20 05:14:04 +00:00
|
|
|
},
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2017-10-15 21:57:35 +00:00
|
|
|
{
|
|
|
|
test: /\.(jpg|png|gif|svg|ico)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
context: 'app/Resources/static',
|
|
|
|
name: '[path][name].[ext]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-03-31 18:21:41 +00:00
|
|
|
{
|
|
|
|
test: /\.(eot|ttf|woff|woff2)$/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'fonts/[name].[ext]',
|
2017-06-20 05:14:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2017-03-31 18:21:41 +00:00
|
|
|
},
|
2017-06-20 05:14:04 +00:00
|
|
|
});
|
2017-03-31 18:21:41 +00:00
|
|
|
};
|