]>
Commit | Line | Data |
---|---|---|
64f81bc3 TC |
1 | const webpack = require('webpack'); |
2 | const webpackMerge = require('webpack-merge'); | |
3 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
4 | const ManifestPlugin = require('webpack-manifest-plugin'); | |
5 | ||
6 | const commonConfig = require('./common.js'); | |
7 | ||
789c4682 | 8 | module.exports = function () { |
64f81bc3 TC |
9 | return webpackMerge(commonConfig(), { |
10 | output: { | |
789c4682 | 11 | filename: '[name].js', |
64f81bc3 TC |
12 | }, |
13 | devtool: 'source-map', | |
14 | plugins: [ | |
15 | new webpack.DefinePlugin({ | |
16 | 'process.env': { | |
789c4682 JB |
17 | 'NODE_ENV': JSON.stringify('production'), |
18 | }, | |
64f81bc3 TC |
19 | }), |
20 | new webpack.optimize.UglifyJsPlugin({ | |
21 | beautify: false, | |
22 | mangle: { | |
23 | screw_ie8: true, | |
789c4682 | 24 | keep_fnames: true, |
64f81bc3 TC |
25 | }, |
26 | compress: { | |
27 | screw_ie8: true, | |
789c4682 | 28 | warnings: false, |
64f81bc3 | 29 | }, |
789c4682 | 30 | comments: false, |
64f81bc3 TC |
31 | }), |
32 | new ExtractTextPlugin('[name].css'), | |
33 | new ManifestPlugin({ | |
34 | fileName: 'manifest.json', | |
789c4682 | 35 | }), |
64f81bc3 TC |
36 | ], |
37 | module: { | |
38 | rules: [ | |
39 | { | |
40 | enforce: 'pre', | |
41 | test: /\.js$/, | |
42 | loader: 'eslint-loader', | |
43 | exclude: /node_modules/, | |
44 | }, | |
45 | { | |
46 | test: /\.js$/, | |
47 | exclude: /(node_modules)/, | |
48 | use: { | |
49 | loader: 'babel-loader', | |
50 | options: { | |
789c4682 JB |
51 | presets: ['env'], |
52 | }, | |
53 | }, | |
64f81bc3 TC |
54 | }, |
55 | { | |
56 | test: /\.(s)?css$/, | |
57 | use: ExtractTextPlugin.extract({ | |
58 | fallback: 'style-loader', | |
59 | use: [ | |
60 | { | |
61 | loader: 'css-loader', | |
62 | options: { | |
63 | importLoaders: 1, | |
64 | minimize: { | |
65 | discardComments: { | |
789c4682 | 66 | removeAll: true, |
64f81bc3 TC |
67 | }, |
68 | core: true, | |
789c4682 JB |
69 | minifyFontValues: true, |
70 | }, | |
71 | }, | |
64f81bc3 TC |
72 | }, |
73 | 'postcss-loader', | |
789c4682 JB |
74 | 'sass-loader', |
75 | ], | |
76 | }), | |
64f81bc3 TC |
77 | }, |
78 | { | |
7a1e1247 KD |
79 | test: /\.(jpg|png|gif|svg|ico)$/, |
80 | include: /node_modules/, | |
64f81bc3 TC |
81 | use: { |
82 | loader: 'file-loader', | |
83 | options: { | |
84 | name: 'img/[name].[ext]', | |
789c4682 JB |
85 | }, |
86 | }, | |
64f81bc3 | 87 | }, |
7a1e1247 KD |
88 | { |
89 | test: /\.(jpg|png|gif|svg|ico)$/, | |
90 | exclude: /node_modules/, | |
91 | use: { | |
92 | loader: 'file-loader', | |
93 | options: { | |
94 | context: 'app/Resources/static', | |
95 | name: '[path][name].[ext]', | |
96 | }, | |
97 | }, | |
98 | }, | |
64f81bc3 TC |
99 | { |
100 | test: /\.(eot|ttf|woff|woff2)$/, | |
101 | use: { | |
102 | loader: 'file-loader', | |
103 | options: { | |
104 | name: 'fonts/[name].[ext]', | |
789c4682 JB |
105 | }, |
106 | }, | |
107 | }, | |
108 | ], | |
64f81bc3 | 109 | }, |
789c4682 | 110 | }); |
64f81bc3 | 111 | }; |