diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-05-09 11:43:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 11:43:48 +0200 |
commit | b28c5430efefa63d04d87404c99798e82d0427e4 (patch) | |
tree | 0bf158fb56120be6624fa26639a28beb84a6598e /app/config/webpack/prod.js | |
parent | 43f81a62e93fb20c7af619a5132276706e989c62 (diff) | |
parent | efac66cb56d650b863b64c9c4582589da6a2442a (diff) | |
download | wallabag-b28c5430efefa63d04d87404c99798e82d0427e4.tar.gz wallabag-b28c5430efefa63d04d87404c99798e82d0427e4.tar.zst wallabag-b28c5430efefa63d04d87404c99798e82d0427e4.zip |
Merge pull request #3022 from wallabag/webpack
Adds Webpack support and remove Grunt
Diffstat (limited to 'app/config/webpack/prod.js')
-rw-r--r-- | app/config/webpack/prod.js | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/app/config/webpack/prod.js b/app/config/webpack/prod.js new file mode 100644 index 00000000..ef41ab99 --- /dev/null +++ b/app/config/webpack/prod.js | |||
@@ -0,0 +1,99 @@ | |||
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 | |||
8 | module.exports = function() { | ||
9 | return webpackMerge(commonConfig(), { | ||
10 | output: { | ||
11 | filename: '[name].js' | ||
12 | }, | ||
13 | devtool: 'source-map', | ||
14 | plugins: [ | ||
15 | new webpack.DefinePlugin({ | ||
16 | 'process.env': { | ||
17 | 'NODE_ENV': JSON.stringify('production') | ||
18 | } | ||
19 | }), | ||
20 | new webpack.optimize.UglifyJsPlugin({ | ||
21 | beautify: false, | ||
22 | mangle: { | ||
23 | screw_ie8: true, | ||
24 | keep_fnames: true | ||
25 | }, | ||
26 | compress: { | ||
27 | screw_ie8: true, | ||
28 | warnings: false | ||
29 | }, | ||
30 | comments: false | ||
31 | }), | ||
32 | new ExtractTextPlugin('[name].css'), | ||
33 | new ManifestPlugin({ | ||
34 | fileName: 'manifest.json', | ||
35 | }) | ||
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: { | ||
51 | presets: ['env'] | ||
52 | } | ||
53 | } | ||
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: { | ||
66 | removeAll: true | ||
67 | }, | ||
68 | core: true, | ||
69 | minifyFontValues: true | ||
70 | } | ||
71 | } | ||
72 | }, | ||
73 | 'postcss-loader', | ||
74 | 'sass-loader' | ||
75 | ] | ||
76 | }) | ||
77 | }, | ||
78 | { | ||
79 | test: /\.(jpg|png|gif|svg)$/, | ||
80 | use: { | ||
81 | loader: 'file-loader', | ||
82 | options: { | ||
83 | name: 'img/[name].[ext]', | ||
84 | } | ||
85 | } | ||
86 | }, | ||
87 | { | ||
88 | test: /\.(eot|ttf|woff|woff2)$/, | ||
89 | use: { | ||
90 | loader: 'file-loader', | ||
91 | options: { | ||
92 | name: 'fonts/[name].[ext]', | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | ] | ||
97 | }, | ||
98 | }) | ||
99 | }; | ||