diff options
Diffstat (limited to 'client/webpack')
-rw-r--r-- | client/webpack/webpack.video-embed.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js index 979da0dff..12ab6a639 100644 --- a/client/webpack/webpack.video-embed.js +++ b/client/webpack/webpack.video-embed.js | |||
@@ -3,15 +3,12 @@ const path = require('path') | |||
3 | 3 | ||
4 | const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin | 4 | const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin |
5 | const HtmlWebpackPlugin = require('html-webpack-plugin') | 5 | const HtmlWebpackPlugin = require('html-webpack-plugin') |
6 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | 6 | const TerserPlugin = require('terser-webpack-plugin') |
7 | const HashedModuleIdsPlugin = require('webpack/lib/HashedModuleIdsPlugin') | ||
8 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | 7 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') |
9 | const ExtractTextPlugin = require('extract-text-webpack-plugin') | 8 | const ExtractTextPlugin = require('extract-text-webpack-plugin') |
10 | const PurifyCSSPlugin = require('purifycss-webpack') | 9 | const PurifyCSSPlugin = require('purifycss-webpack') |
11 | 10 | ||
12 | module.exports = function () { | 11 | module.exports = function () { |
13 | const isProd = process.env.NODE_ENV === 'production' | ||
14 | |||
15 | const configuration = { | 12 | const configuration = { |
16 | entry: { | 13 | entry: { |
17 | 'video-embed': './src/standalone/videos/embed.ts', | 14 | 'video-embed': './src/standalone/videos/embed.ts', |
@@ -72,7 +69,12 @@ module.exports = function () { | |||
72 | importLoaders: 1 | 69 | importLoaders: 1 |
73 | } | 70 | } |
74 | }, | 71 | }, |
75 | 'resolve-url-loader', | 72 | // { |
73 | // loader: 'resolve-url-loader', | ||
74 | // options: { | ||
75 | // debug: true | ||
76 | // } | ||
77 | // }, | ||
76 | { | 78 | { |
77 | loader: 'sass-loader', | 79 | loader: 'sass-loader', |
78 | options: { | 80 | options: { |
@@ -113,9 +115,9 @@ module.exports = function () { | |||
113 | }), | 115 | }), |
114 | 116 | ||
115 | new PurifyCSSPlugin({ | 117 | new PurifyCSSPlugin({ |
116 | paths: [ | 118 | paths: [ |
117 | helpers.root('src/standalone/videos/embed.ts'), | 119 | helpers.root('src/standalone/videos/embed.ts'), |
118 | helpers.root('src/standalone/videos/test-embed.html') | 120 | helpers.root('src/standalone/videos/test-embed.html') |
119 | ], | 121 | ], |
120 | purifyOptions: { | 122 | purifyOptions: { |
121 | minify: true, | 123 | minify: true, |
@@ -158,6 +160,27 @@ module.exports = function () { | |||
158 | }) | 160 | }) |
159 | ], | 161 | ], |
160 | 162 | ||
163 | optimization: { | ||
164 | minimizer: [ | ||
165 | new TerserPlugin({ | ||
166 | terserOptions: { | ||
167 | ecma: 6, | ||
168 | warnings: false, | ||
169 | ie8: false, | ||
170 | mangle: true, | ||
171 | compress: { | ||
172 | passes: 3, | ||
173 | pure_getters: true | ||
174 | }, | ||
175 | output: { | ||
176 | ascii_only: true, | ||
177 | comments: false | ||
178 | } | ||
179 | } | ||
180 | }) | ||
181 | ] | ||
182 | }, | ||
183 | |||
161 | performance: { | 184 | performance: { |
162 | maxEntrypointSize: 700000, // 600kB | 185 | maxEntrypointSize: 700000, // 600kB |
163 | maxAssetSize: 700000 | 186 | maxAssetSize: 700000 |
@@ -174,28 +197,5 @@ module.exports = function () { | |||
174 | } | 197 | } |
175 | } | 198 | } |
176 | 199 | ||
177 | if (isProd) { | ||
178 | configuration.plugins.push( | ||
179 | new UglifyJsPlugin({ | ||
180 | uglifyOptions: { | ||
181 | ecma: 6, | ||
182 | warnings: false, | ||
183 | ie8: false, | ||
184 | mangle: true, | ||
185 | compress: { | ||
186 | passes: 3, | ||
187 | pure_getters: true | ||
188 | }, | ||
189 | output: { | ||
190 | ascii_only: true, | ||
191 | comments: false | ||
192 | } | ||
193 | } | ||
194 | }), | ||
195 | |||
196 | new HashedModuleIdsPlugin() | ||
197 | ) | ||
198 | } | ||
199 | |||
200 | return configuration | 200 | return configuration |
201 | } | 201 | } |