diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 15:05:52 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 15:05:52 +0200 |
commit | 97c42df3b804a37e659c3cda6bd8a52570f31366 (patch) | |
tree | 97c38db7f71a93a7b0db5ca2c682d6d17479cbdb /config/webpack.config.js | |
parent | 3833f1dd84dfec844443a5b1d9ba2bd2b911c0bc (diff) | |
parent | 11716f310dcc495600f5a17e08456a1abb296482 (diff) | |
download | gitlab-ce-97c42df3b804a37e659c3cda6bd8a52570f31366.tar.gz |
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch28717-additional-metrics-review-branch
Diffstat (limited to 'config/webpack.config.js')
-rw-r--r-- | config/webpack.config.js | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index 04a25edcdb2..f27b7cae310 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -11,22 +11,13 @@ var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeMod var ROOT_PATH = path.resolve(__dirname, '..'); var IS_PRODUCTION = process.env.NODE_ENV === 'production'; -var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') !== -1; +var IS_DEV_SERVER = process.argv.join(' ').indexOf('webpack-dev-server') !== -1; var DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost'; var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808; var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; var WEBPACK_REPORT = process.env.WEBPACK_REPORT; var NO_COMPRESSION = process.env.NO_COMPRESSION; -// optional dependency `node-zopfli` is unavailable on CentOS 6 -var ZOPFLI_AVAILABLE; -try { - require.resolve('node-zopfli'); - ZOPFLI_AVAILABLE = true; -} catch(err) { - ZOPFLI_AVAILABLE = false; -} - var config = { // because sqljs requires fs. node: { @@ -234,12 +225,12 @@ if (IS_PRODUCTION) { // zopfli requires a lot of compute time and is disabled in CI if (!NO_COMPRESSION) { - config.plugins.push( - new CompressionPlugin({ - asset: '[path].gz[query]', - algorithm: ZOPFLI_AVAILABLE ? 'zopfli' : 'gzip', - }) - ); + // gracefully fall back to gzip if `node-zopfli` is unavailable (e.g. in CentOS 6) + try { + config.plugins.push(new CompressionPlugin({ algorithm: 'zopfli' })); + } catch(err) { + config.plugins.push(new CompressionPlugin({ algorithm: 'gzip' })); + } } } |